Click here to Skip to main content
15,888,301 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is it possible to read attachment files of an email file with (.eml)

CDO.DropDirectory iDropDir = new CDO.DropDirectory();
CDO.IMessages iMsgs;

CDO.IMessage iMsgReply;
CDO.IMessage iMsgReplyAll;
CDO.IMessage iMsgForward;

// Get the messages from the Drop directory.
iMsgs = iDropDir.GetMessages("C:\\Inetpub\\wwwroot\\Drop");
Response.Write("Messages Count : " + iMsgs.Count.ToString());
foreach (CDO.IMessage iMsg in iMsgs)
{
Response.Write(iMsgs.get_FileName(iMsg));

Response.Write("Subject: " + iMsg.Subject);
Response.Write("TextBody: " + iMsg.TextBody);
Response.Write("datereceived: " + iMsg.Fields["urn:schemas:httpmail:datereceived"].Value);
Response.Write("sendername: " + iMsg.Fields["urn:schemas:httpmail:sendername"].Value);
Response.Write("senderemail: " + iMsg.Fields["urn:schemas:httpmail:senderemail"].Value);
Response.Write("from: " + iMsg.Fields["urn:schemas:httpmail:from"].Value);
Response.Write("sender: " + iMsg.Fields["urn:schemas:httpmail:sender"].Value);
Response.Write("attachment: " + iMsg.Fields["urn:schemas:httpmail:hasattachment"].Value);
Response.Write("attachmentfilename: " + iMsg.Fields["urn:schemas:httpmail:attachmentfilename"].Value);
Response.Write("attachmentfilename: " + iMsg.Attachments);
}

// Clean up memory.
iMsgs = null;
iMsgReply = null;
iMsgReplyAll = null;
iMsgForward = null;
return;
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900