The Mailer component that we use on our Shared Servers is ASPMail from ServerObjects.com
The following example uses ASPMail to send the entire form contents to a specified
person. The fields on the email notice will be in the exact same order as on
your form. (Simpler example further down)
If Request.Form.Count > 0 Then
For I = 1 to Request.Form.Count
Body = Body & Request.Form.Key(I) & " " _
& Request.Form.Item(I) & vbCRLF
Next '*** send email notice
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.RemoteHost = "your-smtp-server"
Mailer.FromName = "Shawn"
Mailer.FromAddress = "shawn@actionjackson.com"
Mailer.AddRecipient "Shawn Jackson", "shawn@actionjackson.com"
Mailer.Subject = "New Profile Entered"
Mailer.BodyText = Body
Mailer.SendMail
Set Mailer = Nothing
Response.Redirect "thankyou.htm"
End If
<html>
<body><form action="<%= Request.ServerVariables("SCRIPT_NAME")
%>" method=post>
<table>
<tr>
<td>First Name</td>
<td><input type=text name="FirstName" size=30 maxlength=50></td>
</tr>
<tr>
<td>Last Name</td>
<td><input type=text name="LastName" size=30 maxlength=50></td>
</tr>
<tr>
<td>Company</td>
<td><input type=text name="Company" size=30 maxlength=50></td>
</tr>
<tr>
<td>Position</td>
<td><input type=text name="Position" size=30 maxlength=50></td>
</tr>
<tr>
<td>Address</td>
<td><input type=text name="Address" size=30 maxlength=100></td>
</tr>
<tr>
<td>City</td>
<td><input type=text name="City" size=30 maxlength=50></td>
</tr>
<tr>
<td>State/Province</td>
<td><input type=text name="State" size=30 maxlength=50></td>
</tr>
<tr>
<td>Zip/Postal Code</td>
<td><input type=text name="Zip" size=30 maxlength=20></td>
</tr>
<tr>
<td>Country</td>
<td><input type=text name="Country" size=30 maxlength=50></td>
</tr>
<tr>
<td>Phone</td>
<td><input type=text name="Phone" size=30 maxlength=30></td>
</tr>
<tr>
<td>Email</td>
<td><input type=text name="Email" size=30 maxlength=100></td>
</tr>
<tr>
<td></td>
<td><input type=submit value="Submit"></td>
</tr>
</table>
</form></body>
</html>
--------------------------------------------------------------------------------
A simple Example
If you are after something a bit simpler you might like to try expanding upon
the following which just sends a simple, pre-defined, email:
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "Test Script"
Mailer.FromAddress= "support@rapidhost.co.uk"
Mailer.RemoteHost = "mx0.myrelayserver.co.uk"
Mailer.AddRecipient "SK Support", "support@rapidhost.co.uk"
Mailer.Subject = "This is a test Subject"
Mailer.BodyText = "This is a test boody"
if Mailer.SendMail then
Response.Write "Mail sent..."
else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if
response.write "done"