sudo apt-get install -y ssmtp
Edit /etc/ssmtp/ssmtp.conf
file:
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES
AuthUser=<YOUR-EMAIL>@gmail.com
AuthPass=<YOUR-PASSWORD>
And make sure that your /etc/php5/apache2/php.ini
have the sendmail_path
configure like:
sendmail_path = /usr/sbin/sendmail -t
Then reload the apache:
sudo service apache2 reload
wp eval 'wp_mail( "your@email.com", "Testing...", "Testing it!" );'