Archive for the ‘SMTP’ Category

Sending automated emails from a web server

Monday, November 19, 2012
posted by daveb

There’s a few things about sending automated emails from an application that stump most people the first time they try it, so I thought I’d share some hard won advice.

These notes relate to setting up a Windows Server to send email, typically a web application that needs to send outbound email.

1. You will want to install your own mail server, probably on your web server. I would suggest either hMailServer or Xeams. These are fantastic, free, open source tools. The key advantage of having your own mail server installed locally is logging. These products give you the level of logging you need when your users call you and advise that they have not received a particular email notification that your application purports to have sent. A second reason to have a product like this installed locally is that they can manage automatic retries on your behalf. A third reason is that having a local mail server means your application does not block when you send an email (it completes almost instantaneously as there is no network latency).
2. You should setup an SPF record with your DNS provider for your web application’s domain. This will reduce the chance that the receiving mail server will reject your email messages as spam by showing that your web server is authorised by the domain owner to send outbound email. An SPF record is actually a TXT record which complies to a standardised format. I suggest using this online tool to help you create the SPF record correctly.