CDO.Message email CC List problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Cheevers

    CDO.Message email CC List problems

    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 = safeServerCreat eObject( "CDO.Messag e" )


    ' Populate its properties

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

    ' Get the CC List
    cdoNewMail.Cc = getCCList

    cdoNewMail.Subj ect = Subject
    cdoNewMail.HTML Body = Body


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

    ' Send the message

    cdoNewMail.Send

    ' Cleanup

    Set cdoNewMail = Nothing


  • Curt_C [MVP]

    #2
    Re: CDO.Message email CC List problems

    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" <paul@nospamaim ware.com> wrote in message
    news:O0FsydSZEH A.3804@TK2MSFTN GP10.phx.gbl...[color=blue]
    > 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[/color]
    field[color=blue]
    > 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[/color]
    the[color=blue]
    > 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 = safeServerCreat eObject( "CDO.Messag e" )
    >
    >
    > ' Populate its properties
    >
    > 'cdoNewMail.Mai lFormat = 0 ' MIME format
    > cdoNewMail.From = """" & FromName & """" & "<" & FromEmail & ">"
    > cdoNewMail.To = strToEmail
    >
    > ' Get the CC List
    > cdoNewMail.Cc = getCCList
    >
    > cdoNewMail.Subj ect = Subject
    > cdoNewMail.HTML Body = Body
    >
    >
    > 'if the attachment file name is set then attach the file to the mail
    > If(strFileName <> "") Then
    > cdoNewMail.AddA ttachment strFilePath
    > End If
    >
    > ' Send the message
    >
    > cdoNewMail.Send
    >
    > ' Cleanup
    >
    > Set cdoNewMail = Nothing
    >
    >[/color]


    Comment

    • Paul Cheevers

      #3
      Re: CDO.Message email CC List problems

      The value returned from the getCCList function is e.g.
      support@company name.com;suppor t2...ompa ny33.com;support
      4@companyname.c om

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

      Cheers,
      P.



      "Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
      news:OmQfBhSZEH A.212@TK2MSFTNG P12.phx.gbl...[color=blue]
      > 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" <paul@nospamaim ware.com> wrote in message
      > news:O0FsydSZEH A.3804@TK2MSFTN GP10.phx.gbl...[color=green]
      > > 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[/color]
      > field[color=green]
      > > 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[/color]
      > the[color=green]
      > > 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[/color][/color]
      any[color=blue][color=green]
      > > 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 = safeServerCreat eObject( "CDO.Messag e" )
      > >
      > >
      > > ' Populate its properties
      > >
      > > 'cdoNewMail.Mai lFormat = 0 ' MIME format
      > > cdoNewMail.From = """" & FromName & """" & "<" & FromEmail & ">"
      > > cdoNewMail.To = strToEmail
      > >
      > > ' Get the CC List
      > > cdoNewMail.Cc = getCCList
      > >
      > > cdoNewMail.Subj ect = Subject
      > > cdoNewMail.HTML Body = Body
      > >
      > >
      > > 'if the attachment file name is set then attach the file to the mail
      > > If(strFileName <> "") Then
      > > cdoNewMail.AddA ttachment strFilePath
      > > End If
      > >
      > > ' Send the message
      > >
      > > cdoNewMail.Send
      > >
      > > ' Cleanup
      > >
      > > Set cdoNewMail = Nothing
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Aaron [SQL Server MVP]

        #4
        Re: CDO.Message email CC List problems

        > safeServerCreat eObject("CDO.Me ssage")

        What is this function?
        [color=blue]
        > cdoNewMail.From = """" & FromName & """" & "<" & FromEmail & ">"[/color]

        Have you tried just using an e-mail address here, instead of the expanded
        format?
        [color=blue]
        > cdoNewMail.Cc = getCCList[/color]

        Can you show the code for this function or whatever builds this string?
        [color=blue]
        > cdoNewMail.Send[/color]

        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

        --
        Please contact this domain's administrator as their DNS Made Easy services have expired.

        (Reverse address to reply.)


        Comment

        • Paul Cheevers

          #5
          Re: CDO.Message email CC List problems

          Function safeServerCreat eObject( strClassId )


          Dim objInstance

          On Error Resume Next


          Set objInstance = Server.CreateOb ject( strClassId )

          If ( Err.Number <> 0 ) Then

          handleError "ServerCreateOb ject", Err.Number,
          strClassId, Err.Description , "", ""

          End If


          On Error GoTo 0

          Set safeServerCreat eObject = objInstance

          End Function

          I tried using the email address for the 'cdoNewMail.Fro m' 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 =
          "support@compan yname.com;suppo rt2@company1.co m;support3@comp any33.com;suppo r
          t
          4@companyname.c om"

          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]" <ten.xoc@dnartr eb.noraa> wrote in message
          news:%23GlAY1SZ EHA.3012@tk2msf tngp13.phx.gbl. ..[color=blue][color=green]
          > > safeServerCreat eObject("CDO.Me ssage")[/color]
          >
          > What is this function?
          >[color=green]
          > > cdoNewMail.From = """" & FromName & """" & "<" & FromEmail & ">"[/color]
          >
          > Have you tried just using an e-mail address here, instead of the expanded
          > format?
          >[color=green]
          > > cdoNewMail.Cc = getCCList[/color]
          >
          > Can you show the code for this function or whatever builds this string?
          >[color=green]
          > > cdoNewMail.Send[/color]
          >
          > 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.)
          >
          >[/color]


          Comment

          • Paul Cheevers

            #6
            Re: CDO.Message email CC List problems

            fixed it!!!

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

            "Paul Cheevers" <paul@nospamaim ware.com> wrote in message
            news:%23pAiY%23 SZEHA.3596@tk2m sftngp13.phx.gb l...[color=blue]
            > Function safeServerCreat eObject( strClassId )
            >
            >
            > Dim objInstance
            >
            > On Error Resume Next
            >
            >
            > Set objInstance = Server.CreateOb ject( strClassId )
            >
            > If ( Err.Number <> 0 ) Then
            >
            > handleError "ServerCreateOb ject", Err.Number,
            > strClassId, Err.Description , "", ""
            >
            > End If
            >
            >
            > On Error GoTo 0
            >
            > Set safeServerCreat eObject = objInstance
            >
            > End Function
            >
            > I tried using the email address for the 'cdoNewMail.Fro m' 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 =
            >[/color]
            "support@compan yname.com;suppo rt2@company1.co m;support3@comp any33.com;suppo r[color=blue]
            > t
            > 4@companyname.c om"
            >
            > I also added the on error resume next but it does not catch the 'Error'.[/color]
            In[color=blue]
            > fact I don't think the send method is retuning an error its just not[/color]
            sending[color=blue]
            > the emails!
            >
            > Cheers,
            > P.
            >
            > "Aaron [SQL Server MVP]" <ten.xoc@dnartr eb.noraa> wrote in message
            > news:%23GlAY1SZ EHA.3012@tk2msf tngp13.phx.gbl. ..[color=green][color=darkred]
            > > > safeServerCreat eObject("CDO.Me ssage")[/color]
            > >
            > > What is this function?
            > >[color=darkred]
            > > > cdoNewMail.From = """" & FromName & """" & "<" & FromEmail &[/color][/color][/color]
            ">"[color=blue][color=green]
            > >
            > > Have you tried just using an e-mail address here, instead of the[/color][/color]
            expanded[color=blue][color=green]
            > > format?
            > >[color=darkred]
            > > > cdoNewMail.Cc = getCCList[/color]
            > >
            > > Can you show the code for this function or whatever builds this string?
            > >[color=darkred]
            > > > cdoNewMail.Send[/color]
            > >
            > > 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.)
            > >
            > >[/color]
            >
            >[/color]


            Comment

            Working...