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

bharathn-msft 5,096 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.
7,921 questions
0 comments No comments
{count} votes

Accepted answer
  1. Grmacjon-MSFT 18,456 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

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

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