Relay mail from your server without MTA

Read it in: CatalàCastellano

Sometime you need to send notifications or simply you need to use sendmail command from your server, but you don't want to use a local mail server. Maybe use simple SMTP (ssmtp) could be a good idea to solve this kind of situations.

I use to configure SSMTP with a GMail account to send notifications from server different daemons, for example, crontab, supervisord, etc.

This is a cookbook configuration for SSMTP and GMail:

/etc/ssmtp/ssmtp.conf

root=user@gmail.com mailhub=smtp.gmail.com:587 rewriteDomain= hostname=user@gmail.com UseSTARTTLS=YES AuthUser=user@gmail.com AuthPass=password FromLineOverride=YES

/etc/ssmtp/revaliases

root:username@gmail.com:smtp.gmail.com:587 localusername:username@gmail.com:smtp.gmail.com:587

Installation in ubuntu server is as easy as: apt-get install ssmtp