ssandoy ssandoy -4 years ago 215
Ruby Question

ActionMailer not sending mail in development Rails 5

I am having some problem with sending email in my web-application. When I am running development the email is not sent even though it is showing as sent in the Console.

This is my settings in config/environments/development.rb

# Email
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
address: '',
port: '587',
enable_starttls_auto: true,
user_name: ENV["gmail_username"],
password: ENV["gmail_password"],
authentication: :plain,
domain: ''

In my controller I am sending mail using this call:


The mail is showing as "sent" in the Console, but it is not sent to the specified mail.

Answer Source

You need to use deliver! to send out the mail immediately.

Just update the code to


-- edited to use deliver! method, per comments.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download