By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,190 Members | 2,204 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,190 IT Pros & Developers. It's quick & easy.

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

P: n/a
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"
<fo**************@domain.com>.

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: da***@test.com
x-receiver: al@test.com
x-receiver: mi**@test.com
Thanks

David
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.