The following forum(s) are migrating to a new home on Microsoft Q&A (Preview): Azure App Service - Web Apps!

Ask new questions on Microsoft Q&A (Preview).
Interact with existing posts until December 13, 2019, after which content will be closed to all new and existing posts.

Learn More

 none
I want to send emails via SMTP from an autoscaling web app RRS feed

  • Question

  • Hi

    Can you confirm whether it is possible to send SMTP mail from a web app (direct, not to another relay server)? I need to send around 100,000 emails per day in bursts, i.e. I would scale the web app up and down accordingly throughout the day.

    The cost of using something like SendGrid is prohibitive for this amount of emails but to do it myself I need permanent dedicated IP addresses with pointer records mapped to a host name for each instance of the web app.

    Is it possible, what Azure setup do I need? If not possible is there another other way using Azure services (worker role, VMs)?

    Thanks
    Andrew

    Wednesday, December 30, 2015 10:55 PM

All replies

  • To send SMTP email you will need a SMTP server. I don`t think Azure App Service has any build in SMTP server. 

    If you do not want to use third party email service, you can use Azure Virtual Machine and config your own SMTP server.

    Thursday, December 31, 2015 1:25 AM
  • My question isn't very clear.  I can run an SMTP server as either a WebJob or Worker role. I need to know if both technologies support the assignment of permanent IP addresses to each instance of the service running.

    Sunday, January 3, 2016 10:03 PM
  • The short answer, you can.

    For a Worker Role, that means you use Cloud Services, you just need to pay for a Reserved IP and then assign that IP on the Cloud Service creation, all the steps are here. One problem is that it needs to be assigned on the Cloud Service creation, I could never assign one on a Cloud Service I had already running.

    For a WebJob, running on an App Service, you will need App Service Environment, the steps are here. Keep in mind that ASE is a Premium tier service and more expensive than a normal App Service.

    I believe it will be much cheaper and simpler to just use Amazon SES and send them from your .Net (or prefered technology/language) as a normal smtp server. MailGun is another alternative.

    Sending that amount of emails from your own servers will only get you blacklisted quite quickly.

    Monday, January 4, 2016 2:30 AM
  • Amazon SES is a possibility. I don't except the blacklisting argument. If you send spam and lots of unwanted emails you'll get blacklisted. We send subscriber requested, informational emails.

    In terms of cost, I'm not so sure even Amazon could be cheaper than doing it yourself. I would plan on storing emails in a Service Bus queue and letting worker role instances start-up as needed. Most of the time we'd only need one of the smallest VM sizes running. The worker role can receive from the queue and use System.Net.Mail.SmtpClient to send direct to the email addresses MX record(s). There are plenty of C# DNS tools on GitHub to do the MX lookups.

    Wednesday, January 6, 2016 10:18 AM
  • Sorry, you didn't say that the list was of requested users, you just especified a high-volume throughput so I just pointed out that it can lead to blacklisting.

    Your solution then is what I pointed on my first paragraph, obtaining a Reserved IP and assigning it on the Cloud Service definition.

    Wednesday, January 6, 2016 5:11 PM