Set Up SSMTP for Mail Relay to AuthSMTP

We do not provide SMTP email services from Engine Yard Cloud because the entire EC2 IP space is black-listed by many spam services.

Our recommendation is to get an account with one of the following providers:

After you have your account set up, take note of your username/password and come back to this page.

Note: If using AuthSMTP, go into the control panel and enable SSL access to your mail relay.

Steps to configure your instance

  1. Edit /etc/ssmtp/ssmtp.conf (a config file for ssmtp sendmail) and make it look like the following:

    mailhub=mail.authsmtp.com:2525 
    mailhub=smtp.gmail.com:587 -- used for Google Apps
  2. Replace this with the hostname you want email to come from:

    rewriteDomain=example.com
  3. Set FromLineOverride to make the the From: use the from line from the envelope. The only exception is if no from line is given.

    FromLineOverride=YES
  4. Use SSL/TLS to send secure messages to server:

    UseSTARTTLS=YES
  5. Make sure that this isn’t UseTLS=YES.

    SSL connection to host = Success, Cannot open mail.authsmtp.com:2525 

    If you’re getting errors like the one above then you have the wrong variable. UseTLS doesn’t work with authsmtp, only UseSTARTTLS does.

  6. Add your own user/password here:

    AuthUser=username 
    AuthPass=password
    AuthMethod=DIGEST-MD5 #Comment this out if you are using gmail or google apps
  7. Set your action mailer setting in RAILS_ROOT/config/environment.rb (or an env specific env file if you prefer):

    config.action_mailer.delivery_method = :sendmail  
    config.action_mailer.sendmail_settings = {:arguments => "-i"}
  8. Ensure permissions on the three files /etc/ssmtp/ssmtp.conf, /usr/sbin/ssmtp, /usr/bin/sendmail are properly set:

    $ sudo chmod +x /usr/sbin/ssmtp /usr/bin/sendmail 
    $ sudo chown deploy:deploy /etc/ssmtp/ssmtp.conf

    Where deploy is the name of your SSH user you logged into your instance with.

You should now be able to send email from your application via your SMTP relay.


If you have feedback or questions about this page, add a comment below. If you need help, submit a ticket with Engine Yard Support.

Comments

Article is closed for comments.