phpemailssmtp

PHP mail keeps hanging


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

  • I changed the port from 465 to 587 inside /etc/ssmtp/smtp.conf and it works.

    (Good enough for me)