@Priya Pinto can you please check if you are hitting the throttling limits of O365 (30 mails per minute) in production as per this link https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365
Azure web app suddenly stopped sending emails

Since Jan 2022, we have noticed that emails are not being sent from the Azure web apps.
We are using the following to send emails from the web apps.
a) SMTP service of our domain xyz.com : smtp.office365.com
b) SMTP port : 587
c) Credentials. We have a valid user whose credentials are provided to authenticate the emails sent.
We have tested the email in local environment and its working for following scenarios:
- Email successfully send from one user in xxxx domain to another user in same domain.
- Email successfully send from one user in xxxx domain to another user in a different domain.
None of the scenarios are working in a production environment.
Kindly help us to solve the issue.
2 answers
Sort by: Most helpful
-
Vidya Narasimhan 2,186 Reputation points Microsoft Employee
2022-02-09T15:40:32.297+00:00 SnehaAgrawal-MSFT 11,441 Reputation points Microsoft Employee2022-02-18T08:09:34.527+00:00 Thanks! As above mentioned by Vidya, We recommend to use authenticated SMTP relay services to send email from Azure VMs or from Azure App Service.
(These relay services typically connect through TCP port 587, but they support other ports.) These services are used to maintain IP and domain reputation to minimize the possibility that external domains reject your messages or put them to the SPAM folder.
SendGrid is one such SMTP relay service, but there are others. You might also have an authenticated SMTP relay service on your on-premises servers.
Using these email delivery services isn't restricted in Azure, regardless of the subscription type.
Let us know if you have further query on this or issue remains.
@Priya Pinto there is a possibility that your web app outbound ip is blacklisted in mail servers. Please see this answer as it is relevant to your scenario as well https://stackoverflow.com/questions/58953123/i-can-not-send-email-from-python-azure-function-smtp-office365-com-587/58958407#58958407