sudo apt-get install exim4-base exim4-config
sudo apt-get install exim4-daemon-light
sudo dpkg-reconfigure exim4-config
Type of mail configuration: mail sent by smarthost; no local mail
System mail name: (default)
IP-addresses for incoming SMTP connections: 127.0.0.1
Other destinations: (default)
Visible domain name: yourdomain.com
IP address or host name of smarthost: smtp.gmail.com::587
Keep number of DNS-queries minimal? No
Split configuration into small files? No
Postmaster mail address: (empty)
sudo nano /etc/exim4/passwd.client
gmail-smtp.l.google.com:youraccount@gmail.com:yourpassword
*.google.com:youraccount@gmail.com:yourpassword
smtp.gmail.com:youraccount@gmail.com:yourpassword
*.google.com:youraccount@gmail.com:yourpassword
*.gmail.com:youraccount@gmail.com:yourpassword
sudo nano /etc/exim4/update-exim4.conf.conf
dc_eximconfig_configtype='satellite'
dc_other_hostnames='vpsxxxxxx.ovh.net'
dc_local_interfaces='127.0.0.1'
dc_readhost='domainname.com'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost='smtp.gmail.com::587'
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'
sudo update-exim4.conf
sudo /etc/init.d/exim4 restart
echo "This is a test." | mail -s Testing youremail@gmail.com