• <i id='H2rjf'><tr id='H2rjf'><dt id='H2rjf'><q id='H2rjf'><span id='H2rjf'><b id='H2rjf'><form id='H2rjf'><ins id='H2rjf'></ins><ul id='H2rjf'></ul><sub id='H2rjf'></sub></form><legend id='H2rjf'></legend><bdo id='H2rjf'><pre id='H2rjf'><center id='H2rjf'></center></pre></bdo></b><th id='H2rjf'></th></span></q></dt></tr></i><div id='H2rjf'><tfoot id='H2rjf'></tfoot><dl id='H2rjf'><fieldset id='H2rjf'></fieldset></dl></div>
    <tfoot id='H2rjf'></tfoot>
    • <bdo id='H2rjf'></bdo><ul id='H2rjf'></ul>
      <legend id='H2rjf'><style id='H2rjf'><dir id='H2rjf'><q id='H2rjf'></q></dir></style></legend>

        <small id='H2rjf'></small><noframes id='H2rjf'>

      1. 发送带有附件 Microsoft Graph 的邮件不起作用

        Send Mail with attachment Microsoft Graph not working(发送带有附件 Microsoft Graph 的邮件不起作用)

        <small id='kaSqz'></small><noframes id='kaSqz'>

      2. <legend id='kaSqz'><style id='kaSqz'><dir id='kaSqz'><q id='kaSqz'></q></dir></style></legend>

          <bdo id='kaSqz'></bdo><ul id='kaSqz'></ul>

          <i id='kaSqz'><tr id='kaSqz'><dt id='kaSqz'><q id='kaSqz'><span id='kaSqz'><b id='kaSqz'><form id='kaSqz'><ins id='kaSqz'></ins><ul id='kaSqz'></ul><sub id='kaSqz'></sub></form><legend id='kaSqz'></legend><bdo id='kaSqz'><pre id='kaSqz'><center id='kaSqz'></center></pre></bdo></b><th id='kaSqz'></th></span></q></dt></tr></i><div id='kaSqz'><tfoot id='kaSqz'></tfoot><dl id='kaSqz'><fieldset id='kaSqz'></fieldset></dl></div>

              <tbody id='kaSqz'></tbody>
                  <tfoot id='kaSqz'></tfoot>
                  本文介绍了发送带有附件 Microsoft Graph 的邮件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在制作一个应用程序,如 通过这篇文章.

                  I am making an application that sends emails from a User as described by this article.

                  一切都按预期工作,除了我尝试包含附件时.电子邮件发送,但没有附件.我不确定问题是什么,因为我已经尝试了几乎所有我可以在网上找到的东西.我已确保我发送的文件以 base64 正确编码.

                  Everything is working as expected, except for when I try to include an attachment. The email sends, but without the attachment. I'm not sure what the problem is as I've tried pretty much everything I could find online. I have made sure the file I am sending is properly encoded in base64.

                  var message = {
                      "subject": subject,
                      "hasAttachments":true,
                      "body": {
                          "contentType": "Text",
                          "content": emailBody
                      }, 
                      "toRecipients": toRecipients,
                      ccRecipients, 
                      bccRecipients
                  };
                  
                  
                  function sendMailRequest(access_token, message, uriSend, file, base64, callback){
                  const attachments = [{
                  '@odata.type': '#microsoft.graph.fileAttachment',
                  "contentBytes": base64
                  "name": "example.jpg"
                  }];
                  
                  // Configure the request
                  var options2 = {
                  "url": uriSend,
                  "method": 'POST',
                  "headers": { 
                      'Authorization': access_token,
                      'Content-Type': 'application/json'
                  },
                  "body": JSON.stringify({
                      "message": message, 
                      "SaveToSentItems": "true",
                      "Attachments": attachments
                  })
                  }
                  

                  推荐答案

                  附件位于 message JSON 内部,而不是外部.这应该有效:

                  Attachments go inside the message JSON, not outside of it. This should work:

                  function sendMailRequest(access_token, message, uriSend, file, base64, callback) {
                    const attachments = [
                      {
                        "@odata.type": "#microsoft.graph.fileAttachment",
                        "contentBytes": base64
                        "name": "example.jpg"
                      }
                    ];
                  
                    message["attachments"] = attachments;
                  
                    // Configure the request
                    var options2 = {
                      "url": uriSend,
                      "method": "POST",
                      "headers": { 
                        "Authorization": access_token,
                        "Content-Type": "application/json"
                      },
                      "body": JSON.stringify({
                        "message": message, 
                        "SaveToSentItems": "true"
                      })
                    }
                    ...
                  }
                  

                  这篇关于发送带有附件 Microsoft Graph 的邮件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Toggle HTML radio button by clicking its label(通过单击标签来切换 HTML 单选按钮)
                  Javascript how to change radio button label text?(Javascript如何更改单选按钮标签文本?)
                  JavaScript radio button confirmation(JavaScript 单选按钮确认)
                  How can I automatically select specific radio buttons with Greasemonkey?(如何使用 Greasemonkey 自动选择特定的单选按钮?)
                  AngularJs. Is it possible to deselect HTML “radio” input by click?(AngularJs.是否可以通过单击取消选择 HTML“收音机输入?)
                  Checking Value of Radio Button Group via JavaScript?(通过 JavaScript 检查单选按钮组的值?)

                        <tbody id='8yyld'></tbody>

                      <tfoot id='8yyld'></tfoot>
                    • <small id='8yyld'></small><noframes id='8yyld'>

                    • <legend id='8yyld'><style id='8yyld'><dir id='8yyld'><q id='8yyld'></q></dir></style></legend>
                        <bdo id='8yyld'></bdo><ul id='8yyld'></ul>
                        1. <i id='8yyld'><tr id='8yyld'><dt id='8yyld'><q id='8yyld'><span id='8yyld'><b id='8yyld'><form id='8yyld'><ins id='8yyld'></ins><ul id='8yyld'></ul><sub id='8yyld'></sub></form><legend id='8yyld'></legend><bdo id='8yyld'><pre id='8yyld'><center id='8yyld'></center></pre></bdo></b><th id='8yyld'></th></span></q></dt></tr></i><div id='8yyld'><tfoot id='8yyld'></tfoot><dl id='8yyld'><fieldset id='8yyld'></fieldset></dl></div>