Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
Thread: IIS - ASP.Net Form Mail
05-15-2008, 11:14 PM #1
- Join Date
- May 2008
- Thanked 0 Times in 0 Posts
IIS - ASP.Net Form Mail
This code will grab all fields from your previous form and send them using SMTP (assuming that you have SMTP set up). After painstakingly trying to figure this out - I got it to work.
One down fall is that the TO, CC, BCC and FROM fields require email addresses only ( I haven't figured out how to allow a display name to be added) - Any questions - hit me up
'Sends an email
Set mail = Server.CreateObject("CDO.Message")
mail.To = "Admin@admin.com"
mail.CC = "Admin2@admin2.com"&","&"email@example.com"
mail.BCC = "Admin4@admin4.com"
mail.From = "firstname.lastname@example.org"
mail.Subject = "IIS Inquiry from (" & Request.Form("Name") & ")"
mail.TextBody = Request.Form.count
strMsgHeader = "Submitted Information as Follows:"& vbCrLf
for i = 1 to Request.Form.Count
strMsgInfo = strMsgInfo & Request.Form.Key(i) & ": " & Request.Form.Item(i) & vbCrLf
strMsgFooter = vbCrLf & "End of form information"
Mail.TextBody = strMsgHeader & strMsgInfo & strMsgFooter
'Destroy the mail object!
Set mail = nothing