Modify recipient list

0 votes
asked May 1 by nicksullivan (200 points)

Hello,

I'm pretty far long the way of getting my solution working however I'm a struggling a little bit with how to modify the recipients. Basically what I'm doing is loading a message from IMAP, then review each recipient and remove some that aren't intended. I can't seem to find any examples of how to create a list of recipients or how to review the current list. Any help would be appreciated.

Thansk
Nick

Applies to: Rebex Secure Mail

1 Answer

0 votes
answered May 2 by Lukas Pokorny (85,590 points)

Hello, there are several ways to retrieve the list of recipients. For example:

a) Retrieve message info (ImapMessageInfo object) using GetMessageInfo method. Use ImapMessageInfo properties such as To or CC to get a list of recipients.

b) Download the message into MailMessage object using GetMailMessage method. Use MailMessage properties such as To or CC to get a list of recipients.

In both cases, the To and CC properties return an instance of MailAddressCollection that can easily be iterated.

The properties of MailMessage can be modified, but please be aware that this won't change the message at the IMAP server.

Unfortunately, the IMAP protocol doesn't make it possible to modify a message at the server, so if you would like to achieve something like that, you have to download the message, modify it, upload it again (it will get a different ID) and delete the original one.

...