Unable to send emails in Azure WebApp utilizing Mandrill

Axium 40 Reputation points
2024-12-09T15:16:53.7+00:00

Hello Azure Community,

I followed the instructions in this article to setup Transactional emails using Mandrill: https://learn.microsoft.com/en-us/aspnet/core/blazor/security/account-confirmation-and-password-recovery?view=aspnetcore-9.0

The below code works on my local machine and sends emails via Mandrill successfully. When I publish the code to my Azure WebApp I get the below error.

When I comment out the Mandrill code and run on Azure everything works (except for the email being sent).

How can I successfully send emails on with Azure Web Apps using Mandrill?

Thank you for your assistance.
User's image

public async Task Execute(string apiKey, string subject, string message, string toEmail)

{

var api = new MandrillApi(apiKey);

var mandrillMessage = new MandrillMessage("******@axium.ca", toEmail, subject, message);

await api.Messages.SendAsync(mandrillMessage);

logger.LogInformation("Email to {EmailAddress} sent!", toEmail);

}

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

1 answer

Sort by: Most helpful
  1. Axium 40 Reputation points
    2024-12-10T22:50:20.44+00:00

    I decided to send the Transactional emails via my GoDaddy exchange server and everything is working now in Azure. Before doing that I also tried SendGrid but emails where getting blocked by Outlook.com

    Microsoft states in the linked article above:

    << We recommend using an email service to send email rather than SMTP. SMTP is difficult to configure and secure properly.

    I am using "smtp.office365.com" and it's working fine. Not sure why Microsoft leads you in the direction of ManDrill. I am open to someone elaborating on why Microsoft does this.

    Thank you


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.