We will see how to configure Exim4 to send system emails with Gmail. This will ensure that your emails sent with your CRON are correctly routed and do not end up in spam.
Let's install Exim4
apt-get install exim4
 Configuration
dpkg-reconfigure exim4-config
 Choose: mail sent by smarthost; no local mail
 
    Then answer the questions as follows:
System mail name: YOUR_HOSTNAME
IP-addresses to listen on for incoming SMTP connections: 127.0.0.1 ; ::1
Other destinations for which mail is accepted: <BLANK>
Visible domain name for local users: <BLANK>
IP address or host name of the outgoing smarthost: smtp.gmail.com::587
Keep number of DNS-queries minimal (Dial-on-Demand)? No
Split configuration into small files? No
Root and postmaster mail recipient: <BLANK>
 Open and edit the file: /etc/exim4/exim4.conf.template
Search for:
.ifdef DCconfig_smarthost DCconfig_satellite
 And add these lines just after:
send_via_gmail:
    driver = manualroute
    domains = ! +local_domains
    transport = gmail_smtp
    route_list = * smtp.gmail.com
 Delete all other smarthost blocks containing:
domains = ! +local_domains
 Comment them out with a # at the beginning of the line
 
    Search for the authenticators with the occurrence:
begin authenticators
 And add these lines:
gmail_login:
    driver = plaintext
    public_name = LOGIN
    client_send = : VOTRE_EMAIL@gmail.com : VOTRE_PASS_GMAIL
 Delete all other blocks that contain:
public_name = LOGIN
 You can also just rename them like this:
login:
  driver = plaintext
  public_name = LOGIN_BACK
 This avoids having a naming conflict.
Then search for:
transport/30_exim4-config_remote_smtp_smarthost
 And add these lines:
gmail_smtp:
    driver = smtp
    port = 587
    hosts_require_auth = $host_address
    hosts_require_tls = $host_address
 Close and save your configuration file: /etc/exim4/exim4.conf.template
We reload the configuration file:
update-exim4.conf
 And we restart the service:
/etc/init.d/exim4 restart
 We can test our email sending:
echo 'Test' | mail -s 'Message test' VOTRE_EMAIL@ADDRESSE