Ruby on Rails, Sending Email with sendmail on Ubuntu VPS



config.action_mailer.delivery_method = :sendmail
config.action_mailer.default_url_options = { host: "", port: 25}

Install sendmail

$ sudo apt-get install sendmail

Configure hosts file correctly:

$ nano /etc/hosts

And make sure the line looks like this: localhost localhost.localdomain yourhostnamehere

Run hostname if you don’t know your hostname.

Reload /etc/hosts, so that the previous changes take effect

sudo /etc/init.d/networking restart that works but seems to be deprecated, better use:

$ /etc/init.d/networking stop
$ /etc/init.d/networking start

Run the sendmail config and answer ‘Y’ to everything:

$ sendmailconfig