CDOSYS with Variable for To: email address

J

Jess

Has anyone been able to use a variable for the To: line with CDOSYS? When I
put in a specific address like: myMail.To = "(e-mail address removed)" it works
fine. When I put in a variable like: myMail.To = areaDirector it doesn't
work. I did a reponse.write on the areaDirector and it comes out like it's
supposed to: (e-mail address removed)

Any ideas? Does it have something to do with the quote marks?
 
K

Kyle Peterson

I Use variables with CDOSYS all the time. Never had an issue ever.
It's essentially the same thing in the end. You got something else going on.
 
D

Dave Anderson

Jess said:
Has anyone been able to use a variable for the To: line with CDOSYS?
When I put in a specific address like: myMail.To =
"(e-mail address removed)" it works fine. When I put in a variable
like: myMail.To = areaDirector it doesn't work. I did a
reponse.write on the areaDirector and it comes out like it's supposed
to: (e-mail address removed)

Any ideas? Does it have something to do with the quote marks?

It has nothing to do with quote marks. I suspect you are assigning an object
reference to your variable rather than a string value. For example:

areaDirector = oRS("director")

In the above example, VBScript will assign the default property only as long
as the recordset object is open, while this variation persists beyond the
lifespan of the recordset:

areaDirector = oRS.Fields("director").Value




--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top