I changed the port from 465 to 587 inside /etc/ssmtp/smtp.conf and it works.
(Good enough for me)
Question
From php.ini
sendmail_path = /usr/sbin/ssmtp -t
The code, which keeps hanging in the browser (I even changed this file to 777)
<?php
error_reporting(E_ALL);
try{
mail('question@stackoverflow.com', 'test', 'test');
}Catch(Exception $ex){
echo 'Exception: ', var_dump($ex, true);
}
echo "Done";
?>
Following works perfectly from terminal
sendmail -v question@stackoverflow.com
TO: question@stackoverflow.com
FROM: question@stackoverflow.com
SUBJECT: test
test
CTRL+D
(Sidenote: I am testing with UFW stopped)
Solution 2
I changed the port from 465 to 587 inside /etc/ssmtp/smtp.conf and it works.
(Good enough for me)
OTHER TIPS
check this example for phpmailer. From here You will get example. And You can download phpmailer class from github.
check this github link link for download.