I got my forms to work and e-mail properly but have two questions:
1. How do I have it a copy sent to the person who fills the form out? It doesn't work to do Mailer.Addrecipient = Request.Form("email_address").
2. How can I make the email be sent in HTML format? It did not work to set Mailer.BodyFormat = 0 and Mailer.MailFormat = 0.
Here's the code I am using:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<%
Dim strMsgHeader, strMsgInfo, strMsgFooter
If Request.querystring("action")="send" then
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = Request.Form("name")
Mailer.FromAddress = Request.Form("email")
Mailer.RemoteHost = "mail.medflight.com"
Mailer.AddRecipient "Smokey Solze", "ssolze@medflight.com"
Mailer.AddRecipient "Marcy Gifford", "mgifford@medflight.com"
Mailer.Subject = "MedFlight PR Event Request"
' Mailer.BodyFormat = 0
' Mailer.MailFormat = 1
strMsgInfo = "General Information: " & vbCrLf
strMsgInfo = strMsgInfo & " Requesting Agency: " & Request.Form("agency") & vbCrLf
strMsgInfo = strMsgInfo & " Contact Name: " & Request.Form("name") & vbCrLf
strMsgInfo = strMsgInfo & " Email Address: " & Request.Form("email") & vbCrLf
strMsgInfo = strMsgInfo & " Contact Phone: " & Request.Form("phone") & vbCrLf
strMsgInfo = strMsgInfo & " Type Phone: " & Request.Form("type") & vbCrLf
strMsgInfo = strMsgInfo & " Cancel Phone: " & Request.Form("cancel") & vbCrLf & vbCrLf
strMsgInfo = strMsgInfo & "Event Information: " & vbCrLf
strMsgInfo = strMsgInfo & " Date of Event: " & Request.Form("date") & vbCrLf
strMsgInfo = strMsgInfo & " Type of Event: " & Request.Form("Nature_Event") & vbCrLf
strMsgInfo = strMsgInfo & " City: " & Request.Form("city") & vbCrLf
strMsgInfo = strMsgInfo & " County: " & Request.Form("county") & vbCrLf
strMsgInfo = strMsgInfo & " Time: " & Request.Form("time") & vbCrLf & vbCrLf
strMsgInfo = strMsgInfo & "Landing Zone Information: " & vbCrLf
strMsgInfo = strMsgInfo & " Where will helicopter land: " & Request.Form("heli_land") & vbCrLf
strMsgInfo = strMsgInfo & " LZ Location: " & Request.Form("lzlocation") & vbCrLf
strMsgInfo = strMsgInfo & " Obstructions: " & Request.Form("obstructions") & vbCrLf
strMsgInfo = strMsgInfo & " Latitude: " & Request.Form("lat") & vbCrLf
strMsgInfo = strMsgInfo & " Longitude: " & Request.Form("long") & vbCrLf
strMsgInfo = strMsgInfo & " Radio Frequency: " & Request.Form("radfreq") & vbCrLf
strMsgInfo = strMsgInfo & " PL Tone: " & Request.Form("pltone") & vbCrLf
strMsgInfo = strMsgInfo & " Latitude: " & Request.Form("lat") & vbCrLf
strMsgInfo = strMsgInfo & " Ground Contact Unit Number: " & Request.Form("ground_contact") & vbCrLf & vbCrLf
strMsgInfo = strMsgInfo & "Special Requests: " & vbCrLf
strMsgInfo = strMsgInfo & Request.Form("spec_requests") & vbCrLf
strMsgHeader = "Your submission has been forwarded to our Business Development staff. Someone will respond to your request within 5 business days. Thank you for your interest in MedFlight." & vbCrLf & vbCrLf
strMsgFooter = vbCrLf & "-----------------------------------" & vbCrLf & "NOTICE TO RECIPIENT: This e-mail is meant for only the intended recipient of the transmission, and may be a communication privileged by law. If you received this e-mail in error, any review, use, dissemination, distribution, or copying of this e-mail is strictly prohibited. Please notify us immediately of the error by return e-mail and please delete this message from your system. Thank you in advance for your cooperation."
Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooter
if Mailer.SendMail then
' Message sent Ok, redirect to a confirmation page
Response.Redirect (" else
' Message send failure
Response.Write ("An error has occurred.<BR>")
' Send error message
Response.Write ("The error was " & Mailer.Response)
end if
end if
%>
1. How do I have it a copy sent to the person who fills the form out? It doesn't work to do Mailer.Addrecipient = Request.Form("email_address").
2. How can I make the email be sent in HTML format? It did not work to set Mailer.BodyFormat = 0 and Mailer.MailFormat = 0.
Here's the code I am using:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<%
Dim strMsgHeader, strMsgInfo, strMsgFooter
If Request.querystring("action")="send" then
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = Request.Form("name")
Mailer.FromAddress = Request.Form("email")
Mailer.RemoteHost = "mail.medflight.com"
Mailer.AddRecipient "Smokey Solze", "ssolze@medflight.com"
Mailer.AddRecipient "Marcy Gifford", "mgifford@medflight.com"
Mailer.Subject = "MedFlight PR Event Request"
' Mailer.BodyFormat = 0
' Mailer.MailFormat = 1
strMsgInfo = "General Information: " & vbCrLf
strMsgInfo = strMsgInfo & " Requesting Agency: " & Request.Form("agency") & vbCrLf
strMsgInfo = strMsgInfo & " Contact Name: " & Request.Form("name") & vbCrLf
strMsgInfo = strMsgInfo & " Email Address: " & Request.Form("email") & vbCrLf
strMsgInfo = strMsgInfo & " Contact Phone: " & Request.Form("phone") & vbCrLf
strMsgInfo = strMsgInfo & " Type Phone: " & Request.Form("type") & vbCrLf
strMsgInfo = strMsgInfo & " Cancel Phone: " & Request.Form("cancel") & vbCrLf & vbCrLf
strMsgInfo = strMsgInfo & "Event Information: " & vbCrLf
strMsgInfo = strMsgInfo & " Date of Event: " & Request.Form("date") & vbCrLf
strMsgInfo = strMsgInfo & " Type of Event: " & Request.Form("Nature_Event") & vbCrLf
strMsgInfo = strMsgInfo & " City: " & Request.Form("city") & vbCrLf
strMsgInfo = strMsgInfo & " County: " & Request.Form("county") & vbCrLf
strMsgInfo = strMsgInfo & " Time: " & Request.Form("time") & vbCrLf & vbCrLf
strMsgInfo = strMsgInfo & "Landing Zone Information: " & vbCrLf
strMsgInfo = strMsgInfo & " Where will helicopter land: " & Request.Form("heli_land") & vbCrLf
strMsgInfo = strMsgInfo & " LZ Location: " & Request.Form("lzlocation") & vbCrLf
strMsgInfo = strMsgInfo & " Obstructions: " & Request.Form("obstructions") & vbCrLf
strMsgInfo = strMsgInfo & " Latitude: " & Request.Form("lat") & vbCrLf
strMsgInfo = strMsgInfo & " Longitude: " & Request.Form("long") & vbCrLf
strMsgInfo = strMsgInfo & " Radio Frequency: " & Request.Form("radfreq") & vbCrLf
strMsgInfo = strMsgInfo & " PL Tone: " & Request.Form("pltone") & vbCrLf
strMsgInfo = strMsgInfo & " Latitude: " & Request.Form("lat") & vbCrLf
strMsgInfo = strMsgInfo & " Ground Contact Unit Number: " & Request.Form("ground_contact") & vbCrLf & vbCrLf
strMsgInfo = strMsgInfo & "Special Requests: " & vbCrLf
strMsgInfo = strMsgInfo & Request.Form("spec_requests") & vbCrLf
strMsgHeader = "Your submission has been forwarded to our Business Development staff. Someone will respond to your request within 5 business days. Thank you for your interest in MedFlight." & vbCrLf & vbCrLf
strMsgFooter = vbCrLf & "-----------------------------------" & vbCrLf & "NOTICE TO RECIPIENT: This e-mail is meant for only the intended recipient of the transmission, and may be a communication privileged by law. If you received this e-mail in error, any review, use, dissemination, distribution, or copying of this e-mail is strictly prohibited. Please notify us immediately of the error by return e-mail and please delete this message from your system. Thank you in advance for your cooperation."
Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooter
if Mailer.SendMail then
' Message sent Ok, redirect to a confirmation page
Response.Redirect (" else
' Message send failure
Response.Write ("An error has occurred.<BR>")
' Send error message
Response.Write ("The error was " & Mailer.Response)
end if
end if
%>