Outlook テンプレートファイル OFT を読み込む
Contents
[
Hide
]
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");
実行コードをダウンロード
サンプルコードをダウンロード
詳細については、こちらをご覧ください Outlook テンプレート ファイル(OFT)を読み取る.