CDO.Message email CC List problems

Discussion in 'ASP General' started by Paul Cheevers, Jul 8, 2004.

  1. 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
     
    Paul Cheevers, Jul 8, 2004
    #1
    1. Advertising

  2. The value returned from the getCCList function is e.g.
    ;;;support


    but if we took ANY email address off it would work.

    Cheers,
    P.



    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:...
    > what's the value of the field when it breaks?
    >
    >
    > --
    > Curt Christianson
    > Owner/Lead Developer, DF-Software
    > Site: http://www.Darkfalz.com
    > Blog: http://blog.Darkfalz.com
    >
    >
    > "Paul Cheevers" <> wrote in message
    > news:...
    > > 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
    > >
    > >

    >
    >
     
    Paul Cheevers, Jul 8, 2004
    #2
    1. Advertising

  3. > 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

    --
    http://www.aspfaq.com/
    (Reverse address to reply.)
     
    Aaron [SQL Server MVP], Jul 8, 2004
    #3
  4. 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 =
    ";;;suppor
    t
    "

    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.

    "Aaron [SQL Server MVP]" <> wrote in message
    news:%...
    > > 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
    >
    > --
    > http://www.aspfaq.com/
    > (Reverse address to reply.)
    >
    >
     
    Paul Cheevers, Jul 8, 2004
    #4
  5. fixed it!!!

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

    "Paul Cheevers" <> wrote in message
    news:%23pAiY%...
    > 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 =
    >

    ";;;suppor
    > t
    > "
    >
    > 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.
    >
    > "Aaron [SQL Server MVP]" <> wrote in message
    > news:%...
    > > > 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
    > >
    > > --
    > > http://www.aspfaq.com/
    > > (Reverse address to reply.)
    > >
    > >

    >
    >
     
    Paul Cheevers, Jul 9, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles
    Replies:
    4
    Views:
    3,582
    Agusitn Rodriguez
    Aug 19, 2003
  2. TaeHo Yoo
    Replies:
    1
    Views:
    1,734
    martin
    Apr 19, 2004
  3. Peter Bassett
    Replies:
    0
    Views:
    210
    Peter Bassett
    Aug 10, 2003
  4. Lin Ma
    Replies:
    2
    Views:
    271
    Steven Burn
    Dec 17, 2003
  5. dave

    sending email using CDO Message

    dave, May 5, 2004, in forum: ASP General
    Replies:
    1
    Views:
    167
    Aaron Bertrand - MVP
    May 5, 2004
Loading...

Share This Page