ניתוח קבצי הודעות של 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());
}