Configuration for mailjet email delivery with Ruby on Rails

Setting up mailjet.com to deliver your mail via Ruby on Rails? Here's how, because their Getting Started is nothing but placeholder headers right now.

Mailjet : Real-time Emailing - mailjet.com

Create an account

Go to https://www.mailjet.com and create an account.

Note: the word "Faculatative" means "optional" on the signup form.

Add your sending address

  • Add a sending address (Accounts > Sender Addresses)
  • Update your Rails ActionMailer configuration
    • Find the settings you need at: https://www.mailjet.com/account/setup
                  SMTP server: 
                  in.mailjet.com
              
                  Username (API Key): 
                  12345678901234567890
              
                  Password (Secret Key): 
                  99999999999999999999999999999999
              
                  Port: 
                  25 or 587 (some providers block port 25)
              
                  Use TLS: 
                  yes    
                
    • Set these settings in config/application.rb (or config/environments/production.rb):
                  
                  config.action_mailer.raise_delivery_errors = false
                  config.action_mailer.perform_deliveries = true
              
                  config.action_mailer.smtp_settings = {
                    :address => "in.mailjet.com",
                    :enable_starttls_auto => true,
                    :port => 587,
                    :authentication => 'plain',
                    :user_name => "12345678901234567890",
                    :password => "99999999999999999999999999999999"
                  }
                  
                

Setup domain authentication (SPF and/or DomainKeys/DKIM)

SPF

My Account - mailjet.com
Click Domain DNS and SMTP setup.
Then, under Domain Authentication, click your domain.

Setting up SPF requires adding a DNS entry. Mailjet will look at your existing one and give you the one to replace it with. It'll look something like:
domainname.com. IN TXT "v=spf1 include:spf.mailjet.com mx ~all"
In my DNS manager, I created a TXT record, gave it a name of "domainname.com." and set the value to the
'v=spf1 include:spf.mailjet.com mx ~all' portion (without the quotes). The full example they give you is for the DNS zone syntax, which you may or may not have.

If you need help configuring this, we would be happy to help you.

DKIM

This is similar, a TXT record that has a key that identifies your server so mail can be sent. Same deal.

Test

Deploy your changes and kick off something that sends a mailer. We have a Notifier model that has a test_email() method that I just called from the console to push a test through. I just went to the reports and saw it there.

All in all, the service seems a little rough around the edges, mostly due to it being a French company that could use a little work on the translations and some serious love on the support documentations. Hope this helps you get started with Mailjet configuration!

Established 2005 · Databasically © 2016