我试图在邮件正文中添加图片,方法是将它们添加到邮件项目的附件中,然后在邮件正文的html中添加具有正确内容id的源。
除了适用于Mac的Outlook之外,它工作得很好。在Outlook for Windows和浏览器(甚至safari)中,图片的插入都是正确的。
在Outlook for Mac中,我得到一个空白方块,并显示文件可能被移动或删除的错误。当我发送电子邮件时,图片插入正确,收件人收到一封带有图片的邮件(在已发送项目中看起来也是正确的)。
仅当在Outlook for Mac上撰写电子邮件时,才会出现此问题。我使用了以下代码:
Office.context.mailbox.item.addFileAttachmentAsync(uri,
assetName,
{ },
function (asyncResult) {
if (asyncResult.status == "failed") {
console.log("Attach action failed with error: " + asyncResult.error.message);
deferred.reject();
}
else {
console.log("Attach action successfull");
deferred.resolve();
}
});发布于 2017-07-18 23:54:06
您是否尝试过在添加文件后执行saveAsync()?我知道在发送电子邮件或将其保存为草稿之前,不会传播许多设置。不幸的是,我不能建立一个测试来确认这将有什么影响,但它可能值得一试:
Office.context.mailbox.item.saveAsync(
function callback(result) {
// Process the result
});发布于 2017-07-18 23:59:36
如果您希望使用内联图像作为附件,则需要将isInline指定为true作为其中一个参数。这是Requirement Set 1.5的一部分,可能在您的Outlook for Mac版本中不可用。下面是一个带有示例的代码片段。
Office.context.mailbox.item.addFileAttachmentAsync
(
"http://i.imgur.com/WJXklif.png",
"cute_bird.png",
{
isInline: true
},
function (asyncResult) {
Office.context.mailbox.item.body.setAsync(
"<p>Here's a cute bird!</p><img src='cid:cute_bird.png'>",
{
"coercionType": "html"
},
function (asyncResult) { }
);
}
);https://stackoverflow.com/questions/45165888
复制相似问题