/ rails

Rails - Send mail from localhost with sendmail

Saw many answers that points to using Google's SMTP.

Well, you can use that, or, if you already have sendmail installed in your machine, just add these few lines to setup action_mailer and start sending mail from your localhost!


config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.action_mailer.delivery_method = :sendmail
config.action_mailer.raise_delivery_errors = true

It also raise an error in development so you know if the mail was sent successfully.

Tested in OSX machine, rails v5.1.1.

Additional configuration if needed:

Rails - Send mail from localhost with sendmail
Share this