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

Help with passing form data into Email

Status
Not open for further replies.

scottew

IS-IT--Management
Mar 6, 2003
492
US
Hello, I am a beginner with ASP and to programming in general. However, I have benn asked to set up a website for our company that has a form which will then email the data to someone. I have downloaded/installed ASPEmail and have that working fine. The problem I am having is getting all of the form data to show up in the body of the email.

The form is similar to this one:

Code:
Name:<input type="text" name="Name" size="50"><br>
Address1:<input type="text" name="Address1" size="50"><br>
Address2:<input type="text" name="Address2" size="50"><br>
City:<input type="text" name="City" size="50"><br>
State:<input type="text" name="State" size="50"><br>
Zip Code:<input type="text" name="Zip" size="50"><br>
Phone:<input type="text" name="Phone" size="50"><br>
Email:<input type="text" name="Email" size="50"><br>

And I would like the body of the email to be formatted similar to this.

Name: form.name
Address1: form.Address1
Address2: form.Address2
City: form.City
State: form.State
Zip Code: form.zip
Email: form.email

Here is the code that I have for the script to send the email:

Code:
<%@LANGUAGE="VBSCRIPT"%> 
<%

If Request.Form("submit") = "Submit" Then
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "smtp.server.com" 
Mail.Port = 25
Mail.From = "email@domain.com"
Mail.FromName = "info@domain.com"
Mail.AddAddress info@domain.com

Mail.Subject = "From Website"

On Error Resume Next
Mail.Send
Set Mail = Nothing 'Clean up your objects!!!
If Err <> 0 Then
Response.Write "Error encountered: " & Err.Description
End If

Response.Redirect("thankyou.asp") 

End If
%>

Any help would be greatly appreciated.

Thanks in advance!
Scott
 
formitem=" & request("formitem") & "<br>" & -
"..."

or if ur happy to just grab the lot:

for each item in request.form
strBody = strBody & item & "=" & request.form(item)
next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top