Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

E-mail click button using text field

Status
Not open for further replies.

rleestma

Technical User
Jul 31, 2001
99
US
Hey...

I want to create a button that will create a blank E-mail using the E-mail address contained in a field...


My E-mail address text field is

EMailAddress

and my form name is

Personnel

I have seen a few forums, but none of the codes have worked..

Thanks,

Ry
 
This works great but you need to make sure ASPMail is installed on the server.If it isnt you should ask them to install it
Its free........
You need to put this on a new page and call it whatever you want ,then post the form to that page.
You can add some HTML or ASP if you want.
Or you could write a response redirect to where you want.
Hope this helps

Email = Request.Form("EMailAddress")
Name = Request.Form("Name")


%> <%
Set mail = Server.CreateObject(&quot;Persits.Mailsender&quot;)
Mail.Host = &quot;A valid domainname.com on your server&quot;



stremail = request.form(&quot;EMailAddress&quot;)
strname = request.form(&quot;Name&quot;)

Mail.From = stremail
Mail.FromName = &quot;strname&quot;
Mail.AddAddress &quot;The Address you wish to send to EG:tom@tomjones.com&quot;
Mail.AddAddress &quot;CC Address&quot;
Mail.AddReplyTo &quot;Your Address&quot;
'Mail.AddAttachment &quot;c:\any file&quot;
strBodyHeader = &quot;A heading&quot; & chr(13) & chr(10) & chr(13) & chr(10)
strBody = strBodyHeader & strBody
Mail.Subject = &quot;Msg Subject&quot;
Mail.body = strBody
'Mail.Body = &quot;&quot; & Chr(13) & Chr(10) & &quot;Thank you for your business.&quot;


On Error Resume Next
Mail.Send
If Err <> 0 Then
Response.Write &quot;Error encountered: &quot; & Err.Description
End If
%>
 
After reading your post again do you need to send a blank email or what please explain more..?
Nick
 
I am going to be sending an E-mail, using the address that is being looked up, then in the subject it's going to insert a field on the form Projects - Current, and in the message it will insert a few fields from the current data on the form Projects - Current.

I'm really completely clueless as to how I should go about this... Should I make an unbound field in my form, or insert the DLookup function into the code for my click button? HELP!!

Thanks!

Ryan
 
So lets say you have a form, Are you asking users to fill this out and then submit at which point it gets emailed to you.
Am i on the right track
 
When you submit this for it will send an email to what email address was in the forms Email field and it will put in the body of the email the name of the sender....
The problem is the email needs to come from a valid email address so you need to use a valid address in the form.
I suggest adding a field that asks the user to enter their Email Address name = &quot;FromEmail&quot;

You will run into problems if they enter An invalid email address so you may want to validate the fields first before sending...


From = Request.Form(&quot;FromEmail&quot;)
Email = Request.Form(&quot;EMailAddress&quot;)
Name = Request.Form(&quot;Name&quot;)


%> <%
Set mail = Server.CreateObject(&quot;Persits.Mailsender&quot;)
Mail.Host = &quot;A valid domainname.com on your server&quot;


strFrom = request.form(&quot;FromEmail&quot;)
stremail = request.form(&quot;EMailAddress&quot;)
strname = request.form(&quot;Name&quot;)

Mail.From = stremail
Mail.FromName = strname
Mail.AddAddress strFrom !if strFrom does not work try putting &quot; either side of it.!
Mail.AddAddress &quot;CC Address&quot;
Mail.AddReplyTo &quot;Your Address&quot;
'Mail.AddAttachment &quot;c:\any file&quot;
strBodyHeader = &quot;A heading&quot; & chr(13) & chr(10) & chr(13) & chr(10)
strBodyHeader = strBodyHeader & &quot;This text will be a field name IE customer name : &quot; & strname & chr(13) & chr(10)
strBody = strBodyHeader & strBody
Mail.Subject = &quot;Msg Subject&quot;
Mail.body = strBody
'Mail.Body = &quot;&quot; & Chr(13) & Chr(10) & &quot;Thank you for your business.&quot;


On Error Resume Next
Mail.Send
If Err <> 0 Then
Response.Write &quot;Error encountered: &quot; & Err.Description
End If
%>
 
Actually, all I really want to do is have the form get the person's E-mail address, then pump it into the E-mail address...

There's got to be a simple way to do this, right? Can't I just use a dlookup function?

Coding expert I am not, so the less coding I have to do the better... I just want to get the basics working right now, I can play with it later and make it more extravagent...

Using a dcCMDSendObject command is what I really want to do, since I am familiar with the contexts involved...

Again, if I can somehow have a field in my form lookup the E-mail address that coorelates to the employees name (that's on the form), then I'm golden...

Thanks!

Ryan
 
OK is your form looking up the email address in a access database 97/2000
And when it does do you just want the user to click on it and it will open their Local email client to send them the info
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top