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!
October 29th, 2008 at 9:08 pm
Thanx Man. I finally got it working
)
Geniality is in Simplicity !!!
February 24th, 2009 at 11:08 am
Hi,
Thanks for your great tutorial.
I was wondering what is the easiest way to make sure that this config is working. Looking for the simplest command to send mail directly from cli…
July 7th, 2009 at 3:43 pm
[...] Configure Exim4 on Debian Etch/Lenny/Sid to use Gmail as a SmartHost. http://tarsysco.com/blogs/2008/06/18/configure-exim4-on-debian-etchlennysid-to-use-gmail-as-a-smarth... [...]
August 16th, 2009 at 6:33 am
I was trying configuring exim4,I am happy enough with your post.But I do have two problems while configuring.
1)/etc/exim4/email-addresses file is not present.(manually added)
2)Error:connection dropped by imap server
August 16th, 2009 at 6:56 am
I am able to resolv the above problem by heaven sake..
-create a folder “Maildir” in the user’s home using “maildirmake Maildir”
-In the console type the following command
chown -R username:username Maildir/