Outlook टेम्पलेट फ़ाइल OFT पढ़ें

Aspose.Email - Outlook टेम्पलेट OFT पढ़ें

Aspose.Email का MailMessage क्लास का उपयोग Microsoft Outlook टेम्पलेट (OFT) फ़ाइल लोड करने के लिए किया जा सकता है। एक बार Outlook टेम्पलेट को MailMessage क्लास के इंस्टांस में लोड कर लेने पर, आप प्रेषक, प्राप्तकर्ता, बॉडी, विषय और अन्य प्रॉपर्टीज़ को अपडेट कर सकते हैं।

Java


 // Load the Outlook template (OFT) file in MailMessage's instance

MailMessage message = MailMessage.load(dataDir + "sample.oft");

// Set the sender and recipients information

String senderDisplayName = "John";

String senderEmailAddress = "john@abc.com";

String recipientDisplayName = "William";

String recipientEmailAddress = "william@xzy.com";

message.setSender(new MailAddress(senderEmailAddress, senderDisplayName));

message.getTo().addMailAddress(new MailAddress(recipientEmailAddress, recipientDisplayName));

message.setHtmlBody(message.getHtmlBody().replace("DisplayName", "<b>" + recipientDisplayName + "</b>"));

// Set the name, location and time in email body

String meetingLocation = "<u>" + "Hall 1, Convention Center, New York, USA" + "</u>";

String meetingTime = "<u>" + "Monday, June 28, 2010" + "</u>";

message.setHtmlBody(message.getHtmlBody().replace("MeetingPlace", meetingLocation));

message.setHtmlBody(message.getHtmlBody().replace("MeetingTime", meetingTime));

// Save the message in MSG format and open in Office Outlook

MapiMessage mapimessage = new MapiMessage().fromMailMessage(message);

mapimessage.setMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT);

mapimessage.save(dataDir + "AsposeInvitation.msg");

चल रहा कोड डाउनलोड करें

नमूना कोड डाउनलोड करें