I need to read the mail contents like To, CC, Subject, Body, Attachments of a mail and store it in Database tables. I am using the below code.
EmailMessage msg = (EmailMessage)item;
foreach (var col in msg.CcRecipients)
{
ccList += col.Address.ToString() + ";";
}
foreach (var col in msg.ToRecipients)
{
toList += col.Address.ToString() + ";";
}
Similarly I can read Body and Subject. Problem is in reading Attachments How to read the Attachments and store it in Database.
I can use msg.Attachments. But What would be the type of the object. Please suggest some better solution to store the attachments to Database.