/ Email / Setting up Email for Rails App

There are a few options that we could choose to help us sending email for our Rails app. In this article I will name a few of good services out there and how you could configure them.

1. Gmail

Gmail is a well-known email provider. It’s always free and very easy to setup. We could use Gmail SMTP to send out the emails but one drawback is the sender name will looks unprofessional. It is okay if you just building it for your school projects or something, but if you want more customisation and all, I suggest you to use Sendgrid or Mailgun.

After you have registered your gmail account, dont forget to “Allow less secure app”. To do this, go to the setting page here .

Allow less secure app Gmail

 

SMPTP setting:

ActionMailer::Base.smtp_settings = {
  :address              => 'smtp.gmail.com',
  :domain               => 'mail.google.com',
  :port                 => 587,
  :user_name            => "GMAIL USERNAME",
  :password             => "GMAIL PASSWORD",
  :authentication       => 'login',
  :enable_starttls_auto => true
}

 

 

2. Sendgrid

The reason many people will choose Sendgrid for Gmail’s alternative is because there is more customisation and setting could be done and plus there will give Free 12K emails per month! Yes you heard it, 12K! Thats really a lot, and for a small projects and even for startup, this is really a great solution that you must try out.

Sendgrid

 

SMPTP setting:

 

ActionMailer::Base.smtp_settings = {
:address => 'smtp.mailgun.org',
:port => 587,
:authentication => :plain,
:domain => "DOMAIN THAT YOU ENTERED ON SENGRID",
:user_name => "SENDGRID USERNAME",
:password => "SENDGRID PASSWORD"
}

 

 

3. Mailgun

Mailgun is also a fantastic service! The main advantage of mailgun is lies on how they let the user easily set up and configure the settings. It’s really easy and useful especially when you want to set up for a two-way email. They also given up free email which is 10K! Less 2K than the Sendgrid, but hey 10K is still awfully a  lot! 😀

Mailgun

 

SMPTP setting:

ActionMailer::Base.smtp_settings = {
  :address        => 'smtp.mailgun.org',
  :port           => 587,
  :authentication => :plain,
  :domain => "SANDBOX NAME.mailgun.org /  YOUR DOMAIN",
  :user_name      => "postmaster@sandbox...mailgun.org / YOUR USERNAME",
  :password       => "YOUR PASSWORD"
}

 

 

No video for this post.

No issues for this post.

by ryzalyusoff