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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem emailing form with ASPemail

Status
Not open for further replies.

scottew

IS-IT--Management
Mar 6, 2003
492
0
0
US
I have installed ASPEmail and I have tested to be sure it is working with another form. Below is another form which I created and I can not get it to work.

Any help would be greatly appreciated.

Thanks,
Scott

Code:
<form name="Contact" method="Post" action="sendmail.asp">
<table>
<tr><td>Email: </td>
<td><input type="text" name="Email" size="50"></td></tr>
<tr><td>Name: </td>
<td><input type="text" name="Name" size="50"></td></tr>
<tr><td>Address: </td>
<td><input type="text" name="Address" size="50"></td></tr>
<tr><td>City: </td>
<td><input type="text" name="City" size="50"></td></tr>
<tr><td>State: </td>
<td><input type="text" name="State" size="50"></td></tr>
<tr><td>Zip: </td>
<td><input type="text" name="Zip" size="50"></td></tr>
<tr><td>Phone: </td>
<td><input type="text" name="Phone" size="50"></td></tr>
<tr><td>Subject: </td>
<td><input type="text" name="Subject" size="50"></td></tr>
<tr><td>Comments: </td>
<td><textarea name="Comments"></textarea></td> 
</table>
<input type="submit" name="Submit" value="Submit Form"> 
</form>

Below is the code for sendmail.asp

Code:
<%
DIM strEmail, strName, strAddress, strCity, strState, strZip, strPhone, strSubject, strComments, Mail
strEmail = request.form("Email")
strName = request.form("Name")
strAddress = request.form("Address")
strCity = request.form("City")
strState = request.form("State")
strZip = request.form("Zip")
strPhone = request.form("Phone")
strSubject = request.form("Subject")
strComments = request.form("Comments")

DIM Mail, strMsgHeader
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "mail.server.com"
Mail.From = strEmail
Mail.AddAddress "info@domain.com"
Mail.AddCC "user@domain.com"
Mail.Subject = "Comments from Website"
strMsgHeader = "This email was delivered from the Website." & vbCrLf & vbCrLf
Mail.Body = strMsgHeader & "Email: " & strEmail & vbCrLf & _
"Name: " & strName & vbCrLf & _
"Address: " & strAddress & vbCrLf & _
"City: " & strCity & vbCrLf & vbCrLf & _
"State: " & strState & vbCrLf & _
"Zip: " & strZip & vbCrLf & _
"Phone: " & strPhone & vbCrLf & _
"Subject: " & strSubject & vbCrLf & vbCrLf & _
"Comments: " & vbCrLf & strComments
On Error Resume Next
Mail.Send
Set Mail = Nothing
IF Err <> 0 THEN
Response.Write "There has been an error and your message could not be sent through email. " & Err.Description
END IF
%>

<P>
<%
Response.Write strFirstName & ",<br>"
Response.Write "Your message has been successfully sent." 
%>,</P>

 
Most SMTP servers require authentication these days

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Below is another form which I created and I can not get it to work.

What is happening? Is it hitting the error message or is it just not doing anything?

<.

 
It doesn't do anything, I get the page can not be displayed.

Also, the mail server that I am using does not require authentication. I have tested to be sure ASPEmail is working with a very basic form. Not that this one is complicated. ;-) Well, I guess it is for me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top