How to configure Exim to send email using a Gmail account as a Smart Host. After following this guide, Exim should be able to send email out to the internet via your Google Gmail account.
1. Prepare Exim4 using dpkg
dpkg-reconfigure exim4-config
Selections:
a) General type of mail configuration: mail sent by smarthost; received via SMTP or fetchmail
b) System mail name: localhost
c) Ip Addr to listen on: 127.0.0.1
d) Other destinations~: <blank>
e) Machines to Relay for: <blank>
f) ip address or hostname of the outgoing smarthost: smtp.gmail.com::587
g) Hide local mail name in outgoing mail: No
h) Keep number of DNS queries minimal: No
i) Delivery method for local mail: Maildir format in home directory
j) Split configuration into small files: Yes
2. As root, edit /etc/exim4/passwd.client and add the following.
Don’t forget to change emailaddress@gmail.com to your own email address and password to your own password:
gmail-smtp.l.google.com:emailaddress@gmail.com:password *.google.com:emailaddress@gmail.com:password smtp.gmail.com:emailaddress@gmail.com:password
Note: You are probably worried about having your password in this file – don’t worry, we’ll make sure the permissions are set correctly in the next step.
3. Set permissions on the /etc/exim4/passwd.client file
Type the following, as root, in the console:
chmod 640 /etc/exim4/passwd.client chown root:Debian-exim /etc/exim4/passwd.client
4. Add/Edit the /etc/exim4/email-addresses file
In the console as root, add or edit the /etc/exim4/email-addresses file. Just add the following line (no others)
your-local-user-name@localhost: your-gmail-email-address
And set permissions:
chmod 640 /etc/exim4/email-addresses
5. Edit the /etc/exim4/update-exim4.conf.conf file
It should look like the following:
dc_eximconfig_configtype='smarthost' dc_other_hostnames='' dc_local_interfaces='127.0.0.1' dc_readhost='' dc_relay_domains='' dc_minimaldns='false' dc_relay_nets='' dc_smarthost='smtp.gmail.com::587' CFILEMODE='644' dc_use_split_config='true' dc_hide_mailname='false' dc_mailname_in_oh='true' dc_localdelivery='maildir_home'
6. Restart Exim
/etc/init.d/exim4 restart
That should be it!