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!

ASP autoreply to submitted E-Mail

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello,

I have an ASP page that contains a textfeald in which the user will have to enter his/her E-mail adress. I would need the rest of the code that would take this E-mail adress and send a pre-defined message back to the E-mail indicated in the form.
Here is my form code:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;test.asp&quot;>
<input type=&quot;text&quot; name=&quot;email&quot;>
Enter E-Mail
<input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot;>
</form>
</body>
</html>


Here is the code I tried out by myself (test.asp), but with no success.


<%@ LANGUAGE=&quot;VBSCRIPT&quot;%>
<%email = request.form(&quot;email&quot;)
Dim MyMail
Set MyMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)
MyMail.From = &quot;justme@myaddress.com&quot;
MyMail.To = &quot; + email + &quot;
MyMail.Cc = &quot;friend3@address3.com;friend4@address4.com&quot;
MyMail.Bcc = &quot;friend5@address5.com;friend6@address6.com&quot;
MyMail.Subject = &quot;sending email via CDONTS NewMail&quot;
MyMail.BodyFormat = 1
MyMail.MailFormat = 0
MyMail.Importance = 2
MyMail.Body = &quot;Sending email with CDONTS NewMail&quot; &_
&quot;objects is easy! Try it!&quot;

MyMail.Send , &quot;youtoo@youraddress.com&quot;, &quot;new subject&quot;
Set MyMail = Nothing
%>


I installed IIS under Win2k and when I try to submit the form with Internet Explorer, it displays the code of &quot;test.asp&quot;. But no mail arives at the submitted E-mail adress.

Do I have to open the asp page directly with my Browser? Under Win98 I used PWS and for the asp to work I had to run it from the program PWS.
How does it work with IIS???
Can someone please correct the code I used!!!

Thanks!

 
MyMail.To = &quot; + email + &quot;
This should be MyMail.To = email or
MyMail.To = Request.Form(&quot;email&quot;)

You don't need a string once it is defined in a variable.
Also when you test it, you might want to consider uploading the whole thing to see if it is really working. Good luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top