Setup email on your Linux server

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

# apt-get install exim4 exim4-config

Choose “mail sent by SMARTHOST; Received via SMTP or fetchmail”

Type System Mail Name “” eg

Type IP address to listen on for incoming SMTP:

Leave Other Destinations BLANK

Leave Machines to relay BLANK

Type Machine Handling outgoing mail (smarthost)

Choose NO, don’t hid local mail

Choose NO, don’t keep number of DNS queries minimal

Choose YES, split configuration into smaller files

Now edit /etc/exim4/passwd.client

nano /etc/exim4/passwd.client

Add the lines


Then make sure root owns the file

chown root /etc/exim4/passwd.client

Now test the system


enter a subject

enter some body text and press Ctrl+d when finished. Check your mail.

Leave a Reply

Your email address will not be published. Required fields are marked *