You need to be sending through a mail service/system or through Exchange Online if the account is licensed for it:
https://zimmergren.net/sending-e-mails-using-microsoft-graph-using-dotnet/
Graph API sends emails but then none is received
I created a new account from the Microsoft 365 Developer Program with my work email (professional account) to set up a Graph application that sends emails whenever I need from a Java application of my own. For now, what I did was:
- On the making of my account, I created a new user (it prompted me to do it) with a Microsoft domain (*.onmicrosoft.com) and did the following from this user:
- Registered a new app from Azure Active Directory (single tenant).
- Created a client secret (24 months expiration).
- Granted the necessary permissions:
Everything until this point seems to be fine, I just did everything the documentation said. But when I try to actually send an email, this happens:
(example from Postman)
Token generated correctly.
Email also sent "correctly", but no matter how many times I send it, or how much time I wait, I never see an email pop in my toRecipients' inbox. I tried several times with different emails. Also, I tried the graph-explorer but had no luck either from there. Any ideas?
2 answers
Sort by: Most helpful
-
Andy David - MVP 147.4K Reputation points MVP
2022-08-04T11:16:35.233+00:00 -
Bhanu Kiran 3,606 Reputation points
2022-08-05T11:34:48.627+00:00 Please check your outlook inbox for any failed delivery mails. This issue is generally observed when you use a trial tenant to send mails using graph API
This error occurs when sending email from known, low reputation IP addresses that are typically used by new customers on Trail tenants. To fix this issue your Tenant needs to be added to a sending exclusion for 60 days to allow them to use blocked IPs whilst they still have a new/trial license.
I would suggest you to raise a case with MS Support team from your tenant where you are facing issue, respective team will provide exclusion for your tenant.
Please look into the post for more information: https://learn.microsoft.com/en-us/answers/questions/951350/index.html
Hope this helps.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".