Try SMTP Server From Rails Console

When working with a none technical person, it is really difficult to identify the problem of SMTP config. It hard to define because the credentials or our config is wrong. Also, we don’t want to config and release it then user spot it is not working. So I create a snippet that can test the SMTP from rails console before you release it.

Start your rails console by type rails c on your terminal.

Config your Mailer.

ActionMailer::Base.smtp_settings = {
  address: 'your.host.domain',
  port: 465,
  authentication: 'plain',
  enable_starttls_auto: true,
  user_name: 'smtp_user',
  password: 'smtp_password'
}

Sending test email

ActionMailer::Base.mail(
  from: "your_sender@email.com",
  to: "your_reciever@email.com",
  subject: "Test",
  body: "Test"
).deliver_now

If you received the test email it means everything is fine.