Chances are if you have a Linux server in your home, you’ll want it to be able to send you emails, e.g. its daily logwatch
or the output from cron
jobs.
But most ISPs block SMTP so you can’t directly send emails from your server to wherever they need to go, which is what the default config of sendmail
does.
So you need to tell sendmail
to forward its mail through something called a Smart Host, which is just an SMTP server that your ISP runs.
First, find out from your ISP what their Smart Host or SMTP server is called. This is usually available somewhere on their website.
Now open up /etc/mail/sendmail.mc
for editing. Locate the following block, remove the dnl
markers and change the name of the server to match your ISP’s.
dnl # Uncomment and edit the following line if your outgoing mail needs to dnl # be sent out through an external mail server: dnl # define(`SMART_HOST', `mail.my-isp.com')
After editing, you have to run the /etc/mail/make program to write the sendmail config file. Then restart the sendmail daemon.
service sendmail restart
Your server is now capable of sending outoing mail through an external mail server. But there’s one final tweak. Open /etc/aliases and change the very last line so that you receive root’s mail.
# Person who should get root's mail root: me@jonathangazeley.com