PHP Mail function should be installed on your server if you want to send emails from your code, to install
1. Install Pear package (if it is not already installed) by running
apt-get install php-pear
yum install php-pear
2. Once the pear installation is complete or if you have PEAR already installed, you can go ahead and install PHP mail and its dependencies function by running
pear install mail pear install Net_SMTP pear install Auth_SASL pear install mail_mime
3. Once done, you can restart the webservice on the service using
service apache2 restart
service httpd restart
That’s it, PHP Mail function is successfully installed on your server.
You can test the function by using the test SMTP Scripts.