Retrieving the x-receiver list from a CDO Message using the Fields Collection

Discussion in 'ASP General' started by David Morgan, Oct 6, 2004.

  1. David Morgan

    David Morgan Guest

    Hello

    I am trying to write a routine that will retrieve all the messages in my
    SMTP Service Drop Folder and process them one by one based on the
    address(es) to which the mail was sent.

    When accessed via a CDO.Message each message in the drop folder has an
    x-receiver field present containing only the email address of the reciepient
    that caused the message to arrive on my server. This is useful because I
    don't have to check the To, CC and BCC fields or strip out names from
    addresses that are formated like "Forename Surname"
    <>.

    I can then look up the receiver in my database based on the email address
    alone.

    The problem is that if a message is sent to two people on my server, there
    will be two x-receiver lines in the email but the fields collection only
    contains one. I guess this might be due to naming or something, as two
    fields can't have the same name, but how do I get the full list of
    recipients.

    I have looked in to smtpenvelope/recipientlist and a few other things, but
    they are either not present or do not work.

    Has anyone come across this before or have any ideas?

    Code so far, which lists all the fields and only shows the first x-receiver
    when the email starts with two:

    Set objDropDir = CreateObject("CDO.DropDirectory")
    Set objMessages = objDropDir.GetMessages(DROP_DIR)

    iMessages = objMessages.Count

    If iMessages > 0 Then
    For iMessage = iMessages To 1 Step -1
    For Each objField In objMessages.Item(iMessage).Fields
    MsgBox objField.Name & ": " & objField.Value
    Next

    Sample email snip:

    x-sender:
    x-receiver:
    x-receiver:


    Thanks

    David
     
    David Morgan, Oct 6, 2004
    #1
    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. Guest
    Replies:
    2
    Views:
    888
    dave wanta
    Jul 11, 2003
  2. Øyvind Isaksen
    Replies:
    1
    Views:
    983
    Øyvind Isaksen
    May 18, 2007
  3. CSINVA

    Using CDO.Message - ReadOnly errors

    CSINVA, Nov 2, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    564
    George Ter-Saakov
    Nov 2, 2007
  4. Paul Cheevers

    CDO.Message email CC List problems

    Paul Cheevers, Jul 8, 2004, in forum: ASP General
    Replies:
    4
    Views:
    178
    Paul Cheevers
    Jul 9, 2004
  5. Replies:
    0
    Views:
    284
Loading...

Share This Page