تحليل ملفات رسائل Microsoft Outlook

Contents
[ ]

مع Aspose.Email، يمكنك تحليل رسائل Microsoft Outlook ببضع سطور من الشيفرة فقط. يوضح هذا المقال كيفية ذلك. تمتلك Aspose.Email فئات لتنفيذ العديد من مهام البرمجة مع رسائل Outlook. يوضح مثال الشيفرة أدناه كيفية:

  1. حمّل رسالة بريد إلكتروني.
  2. احصل على موضوع البريد الإلكتروني.
  3. احصل على اسم المرسل.
  4. احصل على نص الرسالة بالكامل.
  5. اكتشف ما إذا كان هناك مرفقات.
  6. احصل على أسماء ملفات أي مرفقات واحفظها.

يوضح مقتطف الشيفرة التالي كيفية تحليل ملفات رسائل Microsoft Outlook.

// The path to the File directory and Load Microsoft Outlook email message file
String dataDir = "data/";
MapiMessage msg = MapiMessage.fromFile(dataDir + "message3.msg");

// Obtain subject of the email message, sender, body and Attachment count
System.out.println("Subject:" + msg.getSubject());
System.out.println("From:" + msg.getSenderName());
System.out.println("Body:" + msg.getBody());
System.out.println("Attachment Count:" + msg.getAttachments().size());

// Iterate through the attachments
for (MapiAttachment attachment : msg.getAttachments()) {
    // Access the attachment's file name and Save attachment
    System.out.println("Attachment:" + attachment.getFileName());
    attachment.save(dataDir + attachment.getLongFileName());
}