ניתוח קבצי הודעות של Microsoft Outlook
Contents
[
Hide
]
עם Aspose.Email ניתן לנתח הודעות Microsoft Outlook במספר שורות קוד בלבד. מאמר זה מציג כיצד. ל‑Aspose.Email יש מחלקות לביצוע מגוון משימות תכנות עם הודעות Outlook. דוגמת הקוד למטה מראה כיצד לבצע:
- טען הודעת דוא"ל.
- קבל את נושא ההודעה.
- קבל את שם השולח.
- קבל את גוף ההודעה המלא.
- בדוק אם קיימות צרופות.
- קבל את שמות הקבצים של כל הצרופות ושמור אותם.
קטע הקוד הבא מראה איך לנתח קבצי הודעות של 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());
}