Forum Moderators: phranque
For example NAME: - which is the first field, is coming out 6th in the email, and the same with every other field.
Is there anyway to determine in which order to display the data in an email?
Thanks.
' build mail body
mailBody = "Form Submission" & vbCr & vbCr
mailBody = mailBody & "Name: " & name & vbCr
mailBody = mailBody & "E-Mail: " & email & vbCr
mailBody = mailBody & "Telephone: " & telephone & vbCr
mailBody = mailBody & "Message: " & message & vbCr' build email containing submitted information
set mailobj = server.CreateObject("CDONTS.Newmail")
mailobj.From = "me@mydomain.com"
mailobj.To = "me@mydomain.com"
mailobj.Subject = "Form Submission"
mailobj.Body = mailBody
mailobj.Send
set mailobj = nothing
What order are you writing the mailBody variables?
<%
set mailer = server.createobject("SMTPsvg.Mailer")Mailer.FromName = Request.Form("Surname")
Mailer.FromAddress = Request.Form("Email")
Mailer.RemoteHost = "mail.mydomain.com"
Mailer.AddRecipient "Enquiry", "enquiry@mydomain.com"
Mailer.Subject = "Enquiry"For each Item in Request.Form ' Loop through each Form item
strMsgInfo = strMsgInfo & Item & ": " & Request.Form(Item) & vbCrLf
nextstrMsgHeader = "Form information follows" & vbCrLf & "*************"
strMsgFooter = vbCrLf & "*************"
Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooterif Mailer.SendMail then
' Message sent Ok, redirect to a confirmation page
Response.Redirect ("http://www.mydomain.com/confirmation.html")
else
' Message send failure
Response.Write ("An error has occurred.<BR>")
' Send error message
Response.Write ("The error was " & Mailer.Response)
end if
%>