Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

possible to use Omail.To with a variable? 1

Status
Not open for further replies.

deanbri75

Technical User
Jan 6, 2004
26
US
I've got a form that sends results using code from
kav123 in a former post. (Thanks kav).
Code:
<%
Set oMail = Server.CreateObject("CDO.Message") 

oMail.From = "your-email@your-domain.com"
oMail.To = "recipient@another-domain.com"
oMail.Subject = "Here goes the email subject..."
oMail.HTMLBody = "Here goes the email body..."
oMail.Send 

Set oMail = Nothing 
%>
It works like a champ if I hard code the address for oMail.To. However if i try to use my session variable illustrated below, i get a big mess.

Code:
<%
Set oMail = Server.CreateObject("CDO.Message") 

oMail.From = "your-email@your-domain.com"
oMail.To = [b]<%response.write(Session("aubmail"))%>[/b]
oMail.Subject = "Here goes the email subject..."
oMail.HTMLBody = "Here goes the email body..."
oMail.Send 

Set oMail = Nothing 
%>

Is my syntax wrong? Calling that session variable elsewhere has seemed to work fine as a value submitted to a database, write to screen, etc. I wasn't sure why it messed this whole thing up.

thanks,
b
 
I'd like to thank God and the Academy . . oh wait, that's a different thank you speech. The Mail.To suggestion worked perfectly.

Seriously, I am very thankful for your help DaButcher and everyone else who answered my numerous questions that I've had with this project.

Somehow I got dubbed the "IT" guy, so if it plugs into the wall, they assume I have Yoda's skill with it. And while the force may be strong with me, I could not have gotten through this without the forum's extensive help.

thanks again,
b
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top