Trending on MSDN: Unable to send mail through Azure hosting environment

bharathn-msft 5,086 Reputation points Microsoft Employee
2019-10-29T23:21:33.017+00:00

In my web application I am sending mail using using System.Net.Mail; (c#). In my local machine mailing is working fine, but I hosted it on Azure the mail doesn't work.

Sourced from MSDN

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,833 questions
0 comments No comments
{count} votes

Accepted answer
  1. Grmacjon-MSFT 15,441 Reputation points
    2019-10-29T23:23:47.527+00:00

    The only way to use email functionality as of now on Azure Web App is via an SMTP relay. SendGrid is the best way to go if you're trying to set up mail with Azure App Services. If you are not using a relay service to send email, you are in an unsupported scenario within all of Azure (including running an application in a VM or cloud service).

    Microsoft recommends that Azure customers employ authenticated SMTP relay services (typically connected via TCP port 587 or 443, but often support other ports too) to send e-mail from Azure VMs or from Azure App Services. This is because Azure is committed to stopping SPAM and preventing malicious users from using Azure IP addresses for abuse and adversely affecting the reputation of all Azure IPs. The use of these e-mail delivery services is in no way restricted in Azure regardless of subscription type. Relay services include SendGrid, O365, other third-party relay services, and your own on-premises relay services. Please read this blog for more information. You can follow the step by step guide provided in this documentation [https://learn.microsoft.com/en-us/azure/sendgrid-dotnet-how-to-send-email] to learn How to Send Email Using SendGrid with Azure. Let us know if you have additional questions.

    Sourced from MSDN

    0 comments No comments

0 additional answers

Sort by: Most helpful