Since my Fedora Post-installation Configurations article, some things have changed in Fedora 20. For example, for security and economy reasons, Sendmail does not get installed anymore by default. Here are the steps to make your Linux home computer be able to send system e-mails as alerts or from things that run on cron. All commands should be run as user root. This is certified to work on Fedora 21.
- Enable less secure authentication on Google dashboard.
- Install and configure stuff:
yum install sendmail-cf patch wget cyrus-sasl-plain; wget -O /tmp/sendmail.mc.patch http://avi.alkalay.net/articlefiles/2011/01/sendmail.mc.patch; cd /etc/mail; patch < /tmp/sendmail.mc.patch; chmod go-rw authinfo;
- Edit the authinfo file and put your Gmail login and password.
- Configure the system so your mail address receives all mail for root. Do this editing /etc/aliases and make sure it has this line, generally at the very end:
# Person who should get root's mail root: YOUR-EMAIL-ADDRESS@domain.com
- Build new Sendmail configuration, update edited mail aliases database:
cd /etc/mail; make; # to regenerate the config files based on our changes newaliases;
- Create a key and a test certificate for Sendmail so Gmail will allow us to connect:
cd /etc/pki/tls/certs; make -f /usr/share/doc/openssl/Makefile.certificate sendmail.pem;
- Enable Sendmail on boot and start it:
systemctl enable sendmail; systemctl restart sendmail;
Now the system is able to send you warnings, cron outputs etc by e-mail. To test it, you can do this as any user:
mail -a /some/file/to/be/attached -s "Subject line" recipient@somedomain.com <<EOF Body of the message goes here... EOF
The message will be sent with an attachment.
One thought on “GMail as mail relay for your Linux home server”