如何在新电子邮件中写入提取的电子邮件 headers
How to write extracted email headers in a new email
我正在尝试开发一个 Outlook Add-In,允许从选定的电子邮件中提取 headers 并在新电子邮件中打印它们。
为此,我使用以下方法创建了一封新电子邮件,其中包含所选电子邮件的附件:
Office.context.mailbox.displayNewMessageForm({
toRecipients: ["firstname.name@email.com"],
subject: mailSubject,
htmlBody: mailBody,
attachments: [{ type: "item", itemId: Office.context.mailbox.item.itemId, name: Office.context.mailbox.item.subject }]
});
我查看了以下方法以从所选电子邮件中获取 headers:
Office.context.mailbox.item.getAllInternetHeadersAsync(
function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
headers = asyncResult.value; // get the headers
}
}
);
(Un)幸运的是,此方法是异步的,我在创建新电子邮件 (displayNewMessageForm) 后得到 headers。我的目标是将这些 headers 写入用于创建新电子邮件的参数 htmlBody 中。
我尝试使用异步方法创建电子邮件 (displayNewMessageFormAsync),但没有成功。
如果可能,我想获取 headers(异步)并将它们作为 displayNewMessageForm() 方法的参数传递或更新创建的电子邮件以添加 headers(如果可能再次)。
我正在寻求你的帮助!
displayNewMessageForm
应在 getAllInternetHeadersAsync
的回调处理程序中使用。
这对我们有用:
Office.context.mailbox.item.getAllInternetHeadersAsync(
function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
headers = asyncResult.value; // get the headers
Office.context.mailbox.displayNewMessageForm({
toRecipients: ["firstname.name@email.com"],
subject: "Test Subject",
htmlBody: "Internet headers: " + headers,
attachments: [{
type: "item",
itemId: Office.context.mailbox.item.itemId,
name: Office.context.mailbox.item.subject
}]
});
}
}
);
我正在尝试开发一个 Outlook Add-In,允许从选定的电子邮件中提取 headers 并在新电子邮件中打印它们。
为此,我使用以下方法创建了一封新电子邮件,其中包含所选电子邮件的附件:
Office.context.mailbox.displayNewMessageForm({
toRecipients: ["firstname.name@email.com"],
subject: mailSubject,
htmlBody: mailBody,
attachments: [{ type: "item", itemId: Office.context.mailbox.item.itemId, name: Office.context.mailbox.item.subject }]
});
我查看了以下方法以从所选电子邮件中获取 headers:
Office.context.mailbox.item.getAllInternetHeadersAsync(
function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
headers = asyncResult.value; // get the headers
}
}
);
(Un)幸运的是,此方法是异步的,我在创建新电子邮件 (displayNewMessageForm) 后得到 headers。我的目标是将这些 headers 写入用于创建新电子邮件的参数 htmlBody 中。
我尝试使用异步方法创建电子邮件 (displayNewMessageFormAsync),但没有成功。 如果可能,我想获取 headers(异步)并将它们作为 displayNewMessageForm() 方法的参数传递或更新创建的电子邮件以添加 headers(如果可能再次)。
我正在寻求你的帮助!
displayNewMessageForm
应在 getAllInternetHeadersAsync
的回调处理程序中使用。
这对我们有用:
Office.context.mailbox.item.getAllInternetHeadersAsync(
function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
headers = asyncResult.value; // get the headers
Office.context.mailbox.displayNewMessageForm({
toRecipients: ["firstname.name@email.com"],
subject: "Test Subject",
htmlBody: "Internet headers: " + headers,
attachments: [{
type: "item",
itemId: Office.context.mailbox.item.itemId,
name: Office.context.mailbox.item.subject
}]
});
}
}
);