Share via

How can we send email from microsft graph api to third party email providers like gmail/yahoo using asp.net

Aneesh A.S 6 Reputation points
2021-09-01T17:28:09.777+00:00

Hi,
How can we send email from microsoft graph api to third party email providers like gmail/yahoo using asp.net

Microsoft Security | Microsoft Graph

2 answers

Sort by: Most helpful
  1. Aneesh A.S 6 Reputation points
    2021-09-15T09:58:28.383+00:00

    hi,
    I have attached the permissions, which is applied in the account.

    132411-permissions.png

    1 person found this answer helpful.
    0 comments No comments

  2. Danstan Onyango 3,996 Reputation points Microsoft Employee
    2021-09-02T09:10:06.297+00:00

    First, please add the code or request payload you are using to send mail and include the inner error details. You error is 404 and seems to be because you are using an account that does not have a mailbox.

    As for sending mail from Graph to other third party providers, you just need to use MS Graph SendMail and add the emails in the payload. Here is a sample I have used to send mail to Gmail from Exchange.

    POST https://graph.microsoft.com/v1.0/me/sendMail  
    {  
        "message": {  
            "subject": "Meet for lunch?",  
            "body": {  
                "contentType": "Text",  
                "content": "The new cafeteria is open."  
            },  
            "toRecipients": [  
                {  
                    "emailAddress": {  
                        "address": "******@otherdomain.com"  
                    }  
                }  
            ],  
            "ccRecipients": [  
                {  
                    "emailAddress": {  
                        "address": "******@gmail.com"  
                    }  
                }  
            ]  
        },  
        "saveToSentItems": "false"  
    }  
    

    But as I said, your problem seems to be with an account that does not have a mail box. Try again and share the details requested.

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.