VenildoAmaral-8773 avatar image
0 Votes"
VenildoAmaral-8773 asked ·

Send email with attachment - MS Graph

good night
I am sending email without user authentication, automatic method, this is working, but I would like to attach several files to the email, how to do this?
I am using the following code to send email.

 {"message": {
    "subject": "xxxxxx",
    "body": {
      "contentType": "HTML", "content": "yyyyyyyyyyyyy"},
      "toRecipients": [
          "emailAddress": {
            "address": ""}

 Content-Type application/json
 Authorization Bearer " & Token

I know a parameter called attachment, but I was unable to use it pointing a physical file path, I need to point several files to be sent in the email.
How to make?

· 2
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I'm using the following code

    "subject": "Envio de email Teste do MS Graph",
     "contentType": "HTML",
     "content": "Testando envio"
         "address": ""
       "@odata.type": "#microsoft.graph.fileAttachment",
       "name": "Teste de Anexo",
       "contentLocation": "e:\ramos.xlsx",
0 Votes 0 ·

Thank you for your question!

Based off your code, you might have to add the "contentBytes" property since it's required per the fileAttachment resource type. I've also added the Exchange Online and "ms-graph-mail" tags so someone from their team can look into this issue, since the message resource type is a MS Graph API that is not related to AzureAD.

Additional Link:
Graph API Send Mail with Attachments

If you have any other questions, please let me know.
Thank you for your time and patience throughout this issue.

0 Votes 0 ·

0 Answers