CDO.Message email CC List problems

P

Paul Cheevers

Hi,

This is driving me nuts to say the least!!!!!

I am trying to send an email from some server side ASP code and the CC field
is giving me some problems.

The code works fine if I have one or 2 email addresses in the field (The
addresses are valid.) However if I have 4 it breaks. Now the good
part......If I copy the 4 addresses (that were causing the problem) into the
field a few times, so basically I have 16 addresses the code works!!

I don't get an error back from the code when it breaks and I don't see any
emails in the Bad Email, Pickup or Queue folders, the email just doesn't
sent at all.

Also if I put the 4 addresses into the BCC field it works fine. It only
breaks on the CC field.

The code is included below, any help would be greatly appreciated.

Cheers,
P.

Dim cdoNewMail
Set cdoNewMail = safeServerCreateObject( "CDO.Message" )


' Populate its properties

'cdoNewMail.MailFormat = 0 ' MIME format
cdoNewMail.From = """" & FromName & """" & "<" & FromEmail & ">"
cdoNewMail.To = strToEmail

' Get the CC List
cdoNewMail.Cc = getCCList

cdoNewMail.Subject = Subject
cdoNewMail.HTMLBody = Body


'if the attachment file name is set then attach the file to the mail
If(strFileName <> "") Then
cdoNewMail.AddAttachment strFilePath
End If

' Send the message

cdoNewMail.Send

' Cleanup

Set cdoNewMail = Nothing
 
A

Aaron [SQL Server MVP]

safeServerCreateObject("CDO.Message")

What is this function?
cdoNewMail.From = """" & FromName & """" & "<" & FromEmail & ">"

Have you tried just using an e-mail address here, instead of the expanded
format?
cdoNewMail.Cc = getCCList

Can you show the code for this function or whatever builds this string?
cdoNewMail.Send

Do you have on error resume next going in this page? If so, try this:

on error resume next
cdoNewMail.Send
if err.number <> 0 then response.write err.description
 
P

Paul Cheevers

Function safeServerCreateObject( strClassId )


Dim objInstance

On Error Resume Next


Set objInstance = Server.CreateObject( strClassId )

If ( Err.Number <> 0 ) Then

handleError "ServerCreateObject", Err.Number,
strClassId, Err.Description, "", ""

End If


On Error GoTo 0

Set safeServerCreateObject = objInstance

End Function

I tried using the email address for the 'cdoNewMail.From' and no luck.


The function getCCList is as follows

Public Function getCCList()

Dim arrCCList
arrCCList = ToCCEmail

Dim strCCList
strCCList = ""

Dim i

If ( VarType( arrCCList ) >= vbArray ) Then
For i = LBound( arrCCList ) To UBound( arrCCList )
strCCList = strCCList & arrCCList(i) & ";"
Next
Else
strCCList = ToCCEmail
End If

' Finished

getCCList = strCCList

End Function

Note when trying to debug this problem I've changed this line to be:
cdoNewMail.Cc =
"(e-mail address removed);[email protected];[email protected];suppor
t
(e-mail address removed)"

I also added the on error resume next but it does not catch the 'Error'. In
fact I don't think the send method is retuning an error its just not sending
the emails!

Cheers,
P.
 
P

Paul Cheevers

fixed it!!!

it was caused by our spam filtering on our exchange server!!!
 

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,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top