PDA

View Full Version : ASP Mailer


shotsy247
10-28-2006, 10:11 PM
Hi,

I'm creating a mail form using ASP.

I can get it send the email out but I'm having trouble formatting the the mail message.

I want to add some returns in between the variables that I'm including in the mail text. To do so, I'm putting all of the mail text into a single variable. I tried using \r to put in a return, but when the mail is sent there are no returns and you can see the \r.

How can I add these returns?

Here's my script so far:

<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Express Reservation"
myMail.From=request.form("emailAddr")

Dim mailText
mailText = "<p>Hello,</p>"
mailText = mailText & "<p>" & Request.Form("fname") & " " & Request.form("lname") & "<br>"
mailText = mailText & Request.form("address1") & "<br>"

if Request.form("address2") <> "undefined" then
mailText = mailText & Request.form("address2") & "<br>"

end if
mailText = mailText & request.form("town") & ", " & request.form("state") & " " & request.form("zip") & "<br>"
mailText = mailText & "Phone Number: " & request.form("pphone") & "<br>"

if request.form("sphone") <> "" then
mailText = mailText & "Secondary Phone Number: " & request.form("sphone") & "<br>"
end if

mailText = mailText & "<p>Please add/confirm this person is registered for your upcoming auction.</p><p>Thank you. Have a wonderful day!</p>"
myMail.To="email@email.com"
myMail.TextBody=mailText
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
''Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
="mail.mailserver.com"
''Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
Response.Redirect("redir.html")
%>

Thanks.

_t

Cota
10-28-2006, 10:42 PM
The ASP equivalent to "/r" or "/n" is "vbCrLf"

shotsy247
10-28-2006, 11:13 PM
Thanks Cota.

Exactly what I was looking for.

_t