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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BCC not being recognised with CDONTS 1

Status
Not open for further replies.

abienz

Programmer
Aug 13, 2001
53
GB
Hi there,

I'm trying to send an email generated in ASP using CDONTS,
I've tested the mail and it all works fine, except address put into the
BCC object don't get the mail! Here's my code.

Dim Mail
Dim strFrom
Dim strTo
Dim strSubject
Dim strBody

strFrom=company_email
strTo=target_email_address
strSubject = subjectStr
strBody=bodyStr

Set Mail = CreateObject("CDONTS.NewMail")

Mail.From = strFrom
Mail.To = StrFrom
Mail.BCC = strTo
Mail.Subject = strSubject
Mail.Body = strBody
Mail.Send

set Mail = nothing

However this mail only gets sent to the 'To' recipient and not to the BCC
recipients. I got this code form Microsofts site, so I'm a tres confused :(

TIA
 
it works for me.
try doing a response.write of strTo, to make sure it's a valid email address.
 
The email address is valid I've tested it previously by putting strTo after Mail.To aswell as Mail.Bcc, it's formed like this...

"myName@myAddress.com; myOtherName@myAddress.com"

still no joy :(

Please any help would be appreciated I'm really stuck here, I've seen other examples and they all look identical, is there something in IIS that needs to be set in order for Bcc to work?
 
did you try hardcoding an email address in there, ie:

Mail.BCC "youremailaddress@somewhere.com"

and see if that works?
 
funnily enough I just tried doing that, and that didn't work either! :(
 
can you try putting constant email addresses in Mail.From, Mail.To, Mail.Bcc, and also try adding Mail.Cc too, just for good measure....

 
Ok here's what I just tried..

Set Mail = CreateObject("CDONTS.NewMail")

Mail.From = "mymail@myaddress.com"
Mail.To = "mymail@myaddress.com"
Mail.CC = "mymail@myaddress.com; mymail2@myaddress.com"
Mail.BCC = "mymail@myaddress.com; mymail2@myaddress.com"
Mail.Subject = strSubject
Mail.Body = strBody
Mail.Send()

set Mail = nothing

Is this what you meant by using a constant email address, where mymail@myaddress.com is used for From, To, Bcc, and CC?

Thanks for the help so far btw!
 
Ok I've just managed to get an email sent to one of my Bcc recipients! but unfortunatly only 1!

What I changed in teh end was to make the To recipient address a made up address like "notrealaddress" and this worked, however in my Bcc object I have two email addresses seperated by a semicolon and only the first address gets the email :( I have the emails like this

Mail.Bcc "myfirstmail@myaddress.com; mysecondmail@myaddress.com"

So what's wrong with that?
 
Ok I've finally found out what was the problem! firstly I needed to use a faux email address for the Mail.To Object and secondly there was a problem with our proxy server software Multinet, which takes the email but only checks the To and CC fields for addresses, Doh!

So no it's dandy, thanks everyone!
 
Is this what you meant by using a constant email address, where mymail@myaddress.com is used for From, To, Bcc, and CC?


No, actually what I meant was to hardcode an address in there, such as mymail@myaddress.com, as opposed to using a variable, such as bccAddress. Some mail servers will also filter duplicates to the same email address, so using the same address for the To, CC, and Bcc could result in only the To address receiving it. Thus, using different addresses (or invalid address in the To field as you did) could show if it's working or not.

Either way, congratulations on getting it to work!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top