Welcome to WebmasterWorld Guest from 126.96.36.199
Forum Moderators: ocean10000
<form method="POST" action="contact.asp">
Fields marked (*) are required
<input type="text" name="Name">
<input type="text" name="Email">
<p><input type="submit" name="submit" value="Submit">
And the related .ASP file:
' get posted data into variables
EmailFrom = "firstname.lastname@example.org"
EmailTo = "email@example.com"
Subject = "Subject"
Name = Trim(Request.Form("Name"))
Email = Trim(Request.Form("Email"))
Comments = Trim(Request.Form("Comments"))
If (validationOK=false) Then Response.Redirect("error.htm?" & EmailFrom)
' prepare email body text
Body = Body & "Name: " & Name & VbCrLf
Body = Body & "Email: " & Email & VbCrLf
Body = Body & "Comments: " & Comments & VbCrLf
' send email
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = EmailFrom
mail.Subject = Subject
mail.Body = Body
' redirect to success page
Response.Redirect("mysite.htm?" & EmailFrom)
I need to also be able to upload an image and send it to my email address. How do I do this?
Each component has differences, and slight differences in how you use it. But generally you will change the form encryption method and then you access the image like any other field.
Then after that, you will want to save the image, then send it as an attachment in the email. You can look at cdonts for that. Note that I think cdosys is recommended now in place of cdonts.