使用 Microsoft Graph Rest API 发送电子邮件时背景图像不起作用

问题描述 投票:0回答:0
  • 当我尝试使用 Microsoft Graph API 发送具有背景图片的 html 电子邮件时,它不会在实际邮件中显示背景图片。我在这里错过了什么?如果背景图像不支持在 Microsoft 图形电子邮件中显示文本而不是图像的替代解决方案是什么?

  • Graph API Json Body 请求正文

{
    "senderAddress": "[email protected]",
    "requestBody": {
        "message": {
            "toRecipients": [
                {
                    "emailAddress": {
                        "address": "[email protected]"
                    }
                }
            ],
            "attachments": [
                {
                    "@odata.type":"#microsoft.graph.fileAttachment",
                    "name": "backgroundImage",
                    "contentId": "backgroundImage",
                    "isInline": true,
                    "contentBytes": "Valid Base 64 String",
                    "contentType": "image/png"
                }
            ],
            "subject": "Test Mail",
            "body": {
                "contentType": "html",
                "content": "  <div style=\"background-image: url('cid:backgroundImage')\">\r\n    <h1>Hello, World!<\/h1>\r\n    <p>This is the body of the email.<\/p>\r\n  <\/div>"
            },
            "hasAttachments": true
        }
    }
}
  • 收到邮件

enter image description here

microsoft-graph-api azure-ad-graph-api microsoft-graph-sdks microsoft-graph-mail
© www.soinside.com 2019 - 2024. All rights reserved.