Forums

ASP

This topic is locked

Including Form Fields in CDO mail message

Posted 22 Aug 2001 15:39:14
1
has voted
22 Aug 2001 15:39:14 Brian Mears posted:
I am trying to get a CDO mail message to include the values a user entered in a form to display in the body of an email message. The email is going fine but the body is blank. Any thoughts?

I am rather new to UD but have a decent handle on it. Any shoves in the right direction would be greatly appreciated.


Replies

Replied 22 Aug 2001 16:03:06
22 Aug 2001 16:03:06 Owen Eastwick replied:
Try this:


'The header/footer for the email
Const Header = "Start Message"
Const Footer = "End Message"

'The elements of the Form
varOne = Request("textOne"
varTwo = Request("textTwo"
varThree = Request("textThree"

mail_Body = Header & vbCrLf & vbCrLf
mail_Body = mail_Body & "Your Label: " & varOne & vbCrLf
mail_Body = mail_Body & "Your Label: " & varTwo & vbCrLf
mail_Body = mail_Body & "Your Label: " & varThree & vbCrLf
mail_Body = mail_Body & vbCrLf & vbCrLf & Footer

'Create the mail object and send the mail
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail"
objCDO.To = " "
objCDO.From = " "
objCDO.Subject = "Your Subject"
objCDO.Body = mail_Body
objCDO.Send
Set objCDO = Nothing


Regards

Owen.


Replied 22 Aug 2001 18:15:28
22 Aug 2001 18:15:28 Brian Mears replied:
Owen, Thanks. That worked out great!

Reply to this topic