Setup email on your Linux server
From TomSchaefer.org Wiki
I use ubuntu for my webserver. When I want the system to send me alerts or notifications, it doesn’t know how. It will create a system generated email but it doesn’t go anywhere. So why not tell it to use gmail to send emails.
# apt-get install mailx
- Choose Internet with SmartHost
- Type System Mail Name “xxx.xxx.com” eg webz.mot.is-a-geek.com
- Leave SMTP relay host BLANK
# apt-get install exim4 exim4-config
# dpkg-reconfigure exim4-config
- Choose mail sent by SMARTHOST; received via SMTP or fetchmail
- Type System Mail Name “xxx.xxx.com” eg mot.is-a-geek.com
- Type IP Adresses to listen on for incoming SMTP connections: 127.0.0.1
- Leave Other destinations for which mail is accepted BLANK
- Leave Machines to relay mail for BLANK
- Type Machine handling outgoing mail for this host (smarthost): smtp.gmail.com:587
- Choose NO, don't hide local mail name in outgoing mail.
- Chose NO, don't keep number of DNS-queries minimal (Dial-on-Demand).
- Choose what mail delivery method you want...
- Choose YES, split configuration into small files
Now edit /etc/exim4/passwd.client
nano /etc/exim4/passwd.client
Add the lines
gmail-smtp.1.google.com:yourAccountName@gmail.com:Y0uRpAssW
*.google.com:yourAccountName@gmail.com:Y0uRpAssW
smtp.gmail.com:yourAccountName@gmail.com:Y0uRpAssW
Then make sure root owns the file
chown root /etc/exim4/passwd.client
Now test the system
mail you@yourself.com
enter a subject
enter some body text and press Ctrl+d when finished. Check your mail.
