How to configure mail forwarder, using GMAIL as a gateway
Opening a security hole
visit:https://www.google.com/settings/security/lesssecureapps
set it it to "Turn on"
A mail with notification will arrive at your mail and a spam notification on your Android device :@.
Otherwise google will send rejecting during authorization.
Mail gateway
sudo apt-get install ssmtpsudo vim /etc/ssmtp/ssmtp.conf
sudo vim /etc/ssmtp/revaliasesroot=damjandimitrioski@gmail.com mailhub=smtp.gmail.com:587 hostname=freedom FromLineOverride=YES AuthUser=damjandimitrioski # not sure if username or it doesn't care for the domain AuthPass={PUT YOUR PASSWORD}FromLineOverride=yesUseSTARTTLS=YES # Otherwise Google will complains about SSL stuff
# Replace root@ with whatever name
root:root@freedom:smtp.gmail.com:25
The resulting mail will be like this:
root <damjandimitrioski.gmail.com>
Testing
echo "My mail content" | sudo ssmtp -vvv damjandimitrioski@gmail.com
PHP setup
sudo vim /etc/php5/fpm/php.inilocate the [mail function] section and uncomment it
sendmail_path = /usr/sbin/ssmtp -tAfter change, restart php service.
sudo service php5-fpm restart
Testing
$ php -aphp > mail("petko@gmail.com", "My subject", "My ugly short content");