Easily build a great vocabulary without studying! Now on the App Store!
Click here for more info about the app

Using sendmail to send mail on ubuntu box


I normally install postfix for my MTA. However, I've never really used sendmail so I'd decide to give it a whirl for a new application I'm working on. I don't use it for anything but handling the mail that the application needs to send out, like new user welcome emails, password resets, etc.

apt-get install sendmail
Sendmail, unlike postfix, won't work out of the box. Postfix will prompt you for the necessary config setup when running the install. Sendmail won't, and therefore it's not 'out of the box'. You'll have to make some modifications on your own. Nothing major but this is what I've found in order to get it to work, reliably and quickly. The first thing I did was add the fully qualified domain name to my /etc/hosts file

vim /etc/hosts www.mydomain.com

After this I added the fully qualified domain name to my apache default configuration file


ServerName www.mydomain.com

vhost info etc...

Reload and restart...

/etc/init.d/apache2 force-reload
/etc/init.d/sendmail restart

You can test sendmail like so

sendmail email@example.com

This should deliver a message to you (the "." on a new line, followed by a new line, closes the message).

Tagged w/ #apache #configuration #email #mta #sendmail #ubuntulinux