Print Page | Close Window

BCC looping with CDO

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=16489
Printed Date: 30 March 2026 at 4:29am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: BCC looping with CDO
Posted By: snooper
Subject: BCC looping with CDO
Date Posted: 09 September 2005 at 9:23am
hi all.


i have a mailer i'm trying to do, that sends out batches of 10 BCC addresses per email.
what i'm doing is reading the adrresses from a DB into an array of 10 fields. then, in my mailer function, i read that array into the BCC field.

is there maybe some kind of format for this? or is it not allowed? all i can get sent is the one regular TO field, the BCCs dont arrive.

below is the code.

thanks!
 
 
 
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")

'This section provides the configuration information for the remote SMTP server.
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strMailserver
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/usemessageresponsetext ") = True


' If your server requires outgoing authentication uncomment the lines bleow and use a valid email address and password.
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="xxxxx"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="xxxxx"

ObjSendMail.Configuration.Fields.Update

'End remote SMTP server configuration section==

ObjSendMail.To = strSendTo & "<" & strSendToEmail & ">" '"someone@someone.net"

'read from array here:
for h = 0 to 9
if BCCemailARR(h) <> "" then
' this tests that the array does actually have contents:
response.Write(h & ":" &  BCCemailARR(h))
if h = 0 then
ObjSendMail.Bcc = h & " <" &BCCemailARR(h) & "> "  '"someone@someone.net"
else
ObjSendMail.Bcc = ObjSendMail.BCC & h & " <" & BCCemailARR(h) & "> " '"someone@someone.net"
end if
end if
next


ObjSendMail.Subject = strSubject
ObjSendMail.From = "HHHHH <postmaster@HHHH>"
ObjSendMail.ReplyTo  = strReplyTo


strEmailBody = "<html dir=""RTL""><head><title>Message</title></head><body>" & strEmailBody &"</body></html>"

ObjSendMail.HTMLBody = doHTML(Server.HTMLEncode(strEmailBody))


ObjSendMail.Send

Set ObjSendMail = Nothing
 
 
 
 
 
PS:, also just tried with semicolon seperators, but no go.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/6abfd58a-4ef0-41b8-92e8-d30365375a43.asp - http://msdn.microsoft.com/library/d...30365375a43.asp  
 
 



Replies:
Posted By: ub3rl337ch3ch
Date Posted: 11 September 2005 at 7:18pm
if you response.write the value of objsendmail.bcc at the end of the loop, what does it give you?
 
because from what i can see that above isn't going to give you something in the format " mailto:email@thing.com,them@there.com,bob@bob.com - email@thing.com,them@there.com,bob@bob.com "
 
using semicolons should work, but you just have to make sure that the actual bcc value is nothing but email addy's and semicolons. It may be something about my complete lack of understanding in arrays, but it looks like the above will give you something like that includes the number of h as well as email addy's, which will screw it up.
 
would something like this work?
 
.bcc = BCCemailARR(h)
else
.bcc = .bcc & ";" & BCCemailARR(h)
 
 
then again, the whole array thing may just have gone straight past me... LOL


Posted By: snooper
Date Posted: 11 September 2005 at 7:23pm
you're right. i tried with out arrays, and it seems to work. guess i was just complicating myself :)
 
tanks!


Posted By: ub3rl337ch3ch
Date Posted: 11 September 2005 at 7:34pm
1st rule of doing anything: never use 10 steps when 1 will do... LOL



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net