Hi,
I'm working on a form using CDOSYS, what I need to do is to be able to send several variables with text and line breaks using "TextBody", full code below.
All of the asp form samples I have seen use examples such as: myMail.TextBody="This is a message."
Though I need something like this: myMail.TextBody="Message: EmailQuery \n<br> Age: EmailAge \n<br> Nationality: EmailNationality", etc
So that the resulting email would be nicely formatted as:
Message: contents of EmailQuery variable
Age: contents of EmaiAge variable
Nationality: contents of EmailNationality variable
Can someone help?
Thanks,
Al
This is the code I have:
<%
' email values to set in form
'-------------------------
-------
' EmailName
' EmailSurname
' EmailSenders
' EmailSubject
' EmailQuery
' EmailAge
' EmailNationality
' set up email values
EmailName=request("EmailNa
me") ' required
EmailSurname=request("Emai
lSurname")
EmailSenders=request("Emai
lSenders")
' required
EmailSubject=request("Emai
lSubject")
' required
EmailQuery=request("EmailQ
uery") ' required
EmailAge=request("EmailAge
")
EmailNationality=request("
EmailNatio
nality")
if EmailName="" then
response.Write("<html><bod
y>Your first name is required<br><br><a href='javascript:history.b
ack()'>« go back</a></body></html>")
response.End
end if
if EmailSenders="" then
response.Write("<html><bod
y>Your email is required<br><br><a href='javascript:history.b
ack()'>« go back</a></body></html>")
response.End
end if
if EmailSubject="" then
response.Write("<html><bod
y>Please indicate the subject of your message<br><br><a href='javascript:history.b
ack()'>« go back</a></body></html>")
response.End
end if
if EmailQuery="" then
response.Write("<html><bod
y>Please write your query<br><br><a href='javascript:history.b
ack()'>« go back</a></body></html>")
response.End
end if
Set myMail=CreateObject("CDO.M
essage")
myMail.Subject = EmailSubject
myMail.From = EmailName & "<" & EmailSenders & ">"
myMail.To = "me@mydomain.com"
myMail.Cc = "him@hisdomain.com"
myMail.TextBody = EmailQuery
myMail.Send
set myMail=nothing
' show thankyou page
if not request("thanksPage")="" then
response.Redirect(request(
"thanksPag
e"))
else
response.write("<html><bod
y>Message sent.</body></html>")
end if
response.End
%>