使用AzureGraph API进行角度发送邮件+附件

时间:2019-07-04 10:25:23

标签: angular azure-active-directory sendmail azure-ad-graph-api

有人可以分享带有附件的Angular发送邮件的示例吗 我想在邮件中附加一个zip文件。

不了解此“ fileAttachment资源类型”的工作方式。对于 sendMail API https://docs.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&tabs=http https://docs.microsoft.com/en-us/graph/api/resources/fileattachment?view=graph-rest-1.0

代码示例

`mail = {

  message: {
    subject: 'Reminder',
    body: {
      contentType: 'Text',
      content: "Hi ${empl},"
    },
    toRecipients: [
      {
        emailAddress: {
          address: empl,
        }
      }
    ]
 },
 attachments : {
  "@odata.type": "#microsoft.graph.fileAttachment",
  "name": "smile",
  "contentBytes": "base64R0lGODdhEAYEAA7"
}

};

return this.http.post('https://graph.microsoft.com/v1.0/me/sendMail', mail)`

0 个答案:

没有答案