有人可以分享带有附件的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)`