Free Support Forum - aspose.com

MapiMessage getDisplayTo only equivalent to MailMessage getTo method

Hi,

We are moving from java pop3 client where we were using the getTo() method of MailMessage to get the collection of recipients email list, for example “abc@abc.com” “xyz@xyz.com”. Now we are using the graph interface and I am wondering is the getDisplayTo() of MapiMessage the only way to obtain the recipient list? I can use this method, but wondering if I am making things hard on myself as I am having to parse the email list from a string of format “name < abc@abc.com >; name2 < xyz@xyz.com >” into “abc@abc.com” “xyz@xyz.com”.

Thanks for your help.

@mlittle4444,
You can use the collection of recipients from MapiMessage object and getEmailAddress method as follows:

for (MapiRecipient recipient : mapiMessage.getRecipients())
{
    String emailAddress = recipient.getEmailAddress();
    // some code...
}

API Reference: getRecipients, getEmailAddress
More details: Parsing Outlook Message Files

1 Like