12

I am considering the possibility of setting up a simple SMTP+IMAP email server for internal use on an extra small Azure VM. When I say internal use I don't mean "used by internal users", but for use as part of a larger system and to serve the main purpose of receiving email messages for audit/logging purposes which are then handled based on rules, which trigger actions. Occasionally there might be an automatic response back.

My question is whether a simple email server can be hosted inside an Azure VM, because what I see on the Internet from a preliminary search is that Azure does not support Reverse DNS (they do assign almost static IPs nowadays though), which will then caused the occasional auto-response outgoing emails to be marked as spam.

My question is: Is that the case or is there some setup that would allow to workaround this?

Note: This is just a preliminary research type of question. I am not an administrator.

EDIT: To those who would jump in and say use SendGrid. I am not going to be sending newsletters, but mainly receiving emails. Also an Azure extra small instance is $9/month where as SendGrid Push API (which won't let let poll as I would like to) starts at $90/month which is ten times the cost.

EDIT 2: My preference is to implement a poll-based system (poll the server for new emails every X hours) rather than implementing a push+queue based system (most 3rd party servcies provide a Push API that pushes each email to a web url)

EDIT 3: I would prefer not to use a 3rd party service, because I don't want the content of the email and attachments to go through them.

EDIT 4: Look, I am not looking for an advice on how to set it up or which 3rd party service to use. What I am asking is "Is it possible to set up an email server which can receive email and send the occasional email out which won't be marked as spam due to limitations of Azure? If there are limitations - what are those and how can they be worked around?"

Ivan Zlatev
  • 223
  • 1
  • 2
  • 6
  • At first, your ip is static? then, if you want to complete leave any spam, please read http://www.spamhaus.org/ rules. – PersianGulf Feb 12 '13 at 17:28
  • 5
    I'm not saying this to be mean, but if you have to ask "what is involved in setting up a SMTP server?" you're really not ready to take on the challenge of maintaining an internet-connected mail server. It isn't as simple as "start SMTP listener and throw a few records in DNS", and it hasn't been for at least a decade -- you should bring someone in who knows what they're doing, or use an external service provider. – voretaq7 Feb 12 '13 at 17:45
  • @voretaq7 I rewrote my question to be more clear. Essentially, I am not an administrator and I am just doing my preliminary research on whether its possible or not and what are the complications. You could also say that I am more interested in the receiving part than the sending at this point. – Ivan Zlatev Feb 12 '13 at 19:53
  • @IvanZlatev, this is exactly what i am searching for a scalable inbound mail server, can you share what you had used finally? – Anshul Nigam Aug 06 '15 at 09:26

2 Answers2

8

No.

You can't be reasonably sure your outgoing email will be delivered, as many destinations simply blacklist, firewall, or even null route all major cloud providers' IP blocks due to the heavy abuse seen from those ranges - not just from email but via other services as well.

And even if your mail is delivered today, that's no guarantee it will continue to be delivered in future.

You really do need a mail server outside of Azure (or EC2 or whatever) to process your outgoing mail, though it does not necessarily need to be a third party mail server. If you have the expertise, you could do it yourself.

When I put a service on EC2 which had to deliver to a mailing list, I found from testing that almost 3/4 of the list addresses would not accept mail from there. I ended up sending everything to a smarthost located outside EC2. Interestingly, this also improved performance...

Having incoming mail on Azure would be no problem, as the above issues don't apply.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
  • Thanks, that's what I basically wanted to confirm without setting it up - that incoming mails will work. – Ivan Zlatev Feb 14 '13 at 10:04
  • Hi, a bit old, but nowadays you have reverse DNS https://azure.microsoft.com/en-us/blog/announcing-reverse-dns-for-azure-cloud-services/ so theoretically you can do it. – jmservera Apr 04 '16 at 17:38
  • 2
    I've set up quite a few SMTP servers on Azure VMs, implemented reverse DNS, and had absolutely no issues with mail delivery. Just my 2 cents. – blizz Apr 12 '16 at 05:08
  • @blizz New to Azure and am researching setting up SMTP. Could you point to any links/resources on how to get this done? Also, did you get something off the Azure marketplace to run a mail server, or is it a third party program? Thanks! – REMESQ May 02 '16 at 20:04
  • I'm interested in this too – Rodrigo Juarez Jun 17 '16 at 03:05
  • Microsoft is now proactively blacklisting Azure compute IP ranges: https://blogs.msdn.microsoft.com/mast/2016/04/04/sending-e-mail-from-azure-compute-resource-to-external-domains – franzo Jul 22 '16 at 03:55
  • none of our Azure mail ips are blacklisted. works just as well as anywhere else. (last 4 years)... since they implemented PTR they may well have changed that policy. Just use mxtoolbox to monitor anyway, then remove yourself if listed. Most blacklists are automated, so MS can't add the ranges anyway. – Dawesi Feb 23 '17 at 03:15
  • @Dawesi pmji, out of curiosity, do you happen to have an Enterprise Azure account? Coz that's the only way that you don't have outgoing port 25 blocked. I have a Pay-as-you-go, and port 25 is confirmed to be blocked on Azure VMS (and other items as well). – ewokx Sep 06 '22 at 09:53
6

DON'T.

99.999% of the time it makes a lot more sense to use a third-party SMTP / mail handler than to implement your own mail server.

There's even a document on the Azure docs about using Sendgrid.

I highly recommend you follow these guidelines and use Sendgrid (or similar service) as a SMTP relay provider.

The intricacies of setting up a properly configured mailserver are immensely complicated.

Tom O'Connor
  • 27,440
  • 10
  • 72
  • 148
  • My impression with services such as SendGrid is that they provide a facility to send batch emails such as newsletters and similar. My use case is different - I mainly want to receive email, so you answer doesn't really answer my question per se. I have just looked into their Parse API as well, but that starts at $80/month which I simply can't justify for the volume of emails (was thinking of running an extra small Azure VM instance which is $9.36). Additionally in my case it will much much easier to do a poll based system instead of PUSH+queue, which will be required by Push API – Ivan Zlatev Feb 12 '13 at 19:08
  • It doesn't *have* to be sendgrid. There are other SaaS and PaaS providers for email that will still mean you don't need to run your own server. – Tom O'Connor Feb 12 '13 at 20:15
  • How about Postmark? https://postmarkapp.com/inbound Looks cheaper. – Tom O'Connor Feb 12 '13 at 20:17
  • Look, thanks for the Postmark info it's definitely better priced for something like what I have in mind, but essentially my question is "Is it possible to setup a working email server on Azure VM, who's emails won't be marked as spam". – Ivan Zlatev Feb 13 '13 at 13:48
  • 1
    I'm aware of what your question is, but my answer remains unchanged. I'm just stubborn like that. – Tom O'Connor Feb 13 '13 at 15:28
  • 99.999% really? "The intricacies of setting up a properly configured mail server are immensely complicated." Well it's 3 years later and setting up and delivering emails is still a science, but one that can be learnt reasonably quickly from blogs and articles form the experts. Our deliverable rate is close to perfect off Azure. Learn the craft, setup your own mail server and tweak the setup (mail/dns/etc) until you get great results. MS even helped us #irony Go for it, Tom has one opinion. I disagree (from experience) – Dawesi Feb 23 '17 at 03:24