(First, you don't need to edit your php.ini file SMTP settings, because on Linux those are not used by PHP)
1. Install SSMTP on your system (Debian/Ubuntu via apt-get, RHEL/CentOS using the Fedora EPEL Package search to find the package.
2. Use "ssmtp" to replace "sendmail" on your system. ssmtp use the same command argument as sendmail.
3. configure your /etc/ssmtp/ssmtp.conf file:
mailhub=SMTP SERVER IP ADDRESS
#this allows you to specify your from address
4. Now send an email. Type
sSMTP will then wait for you to type your message, which needs to be formatted like this:
Subject: test email
Note the blank like after the subject, everything after this line is the body of the email. When you’re finished, press Ctrl-D.
You can also use script. Create a file msg.txt, then send it:
ssmtp email@example.com < msg.txt
msg.txt is a simple text using the proper formatting for sSMTP:
The server is down!