sudo apt-get install ssmtp
Open /etc/ssmtp/ssmtp.conf
.
sudo vi /etc/ssmtp/ssmtp.conf
Replace with:
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=****@gmail.com
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
#mailhub=mail
mailhub=smtp.gmail.com:587
AuthUser=****@gmail.com
AuthPass=****
UseTLS=YES
UseSTARTTLS=YES
# The full hostname
hostname=localhost
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES
Open /etc/php/7.3/apache2/php.ini
.
sudo vi /etc/php/7.3/apache2/php.ini
Search for ;sendmail_path
and replace with:
sendmail_path = /usr/sbin/ssmtp -t
Restart apache:
sudo service apache2 restart