The Brightbox SMTP Relay

All Brightboxes have access to the Brightbox smtp relay:

ActionMailer configuration

You can configure the Rails ActionMailer to use the smtp relay by dropping the following lines into your production environment config (config/environments/production.rb)

ActionMailer::Base.smtp_settings = {
  :address  => "",
  :port  => 25, 
  :domain  => "",
  :enable_starttls_auto => false,
  :tls => false

Local mail queue

The Brightbox mail relay is fine for quick low volume use, but if you're going to be sending a lot of mails on a regular basis then it's a good idea to run your own mail queue on your Brightbox (or on a dedicated Brightbox for very high volume).

This also gets you logs of your smtp transactions so you can track what is going on. It's also useful if you'd like emails from non-rails app (such as the cron daemon)

Just install the Postfix package and the default configs are a good start:

sudo apt-get install postfix

You can then use the Rails :sendmail delivery method:

ActionMailer::Base.delivery_method = :sendmail

You may need to get a reverse dns entry set up for other servers to reliably accept your mail. File a support request with the desired fqdn and we'll set this up for you.

If you are going to sending a large volume of mail then you'll want to look into tweaking the Postfix configs for this type of work.

Mail guidelines

If you're planning to send a large volume of mail - either from your own Brightbox or via the Brightbox SMTP relay - following these will help ensure that your mails are not caught by recipients' spam filters:

  • Provide an “unsubscribe” link in each mail, and make sure that requests to unsubscribe are dealt with promptly.
  • So far as possible, try to eliminate bad email addresses from your list. Large mail providers such as Gmail and Hotmail tend to block servers which attempt to deliver large volumes of mail to invalid addresses.
docs/smtprelay.txt · Last modified: 2014/02/21 16:39 by ben