I'm trying to send mails from a contact form in a page on my server.
I followed this post.
My PHP file /var/www/my_project/test.php is this:
<?php
$myemail = "[email protected]";
$subject = "my subject";
$message = "my message ";
mail($myemail, $subject, $message);
echo "sent";
?>
If I run the PHP file from the shell:
php /var/www/my_project/test.php
I receive the email in Gmail, then, I'm supposing ssmtp is well configured, right?
But if I run the PHP from the browser:
http://localhost/my_project/test.php
it doesn't send the mail and it creates this file with the email content:
/var/www/dead.letter
I did these steps too:
costales@server:~$ sudo cat /etc/php5/apache2/php.ini | grep sendmail
sendmail_path = /usr/sbin/sendmail -t
costales@server:~$ sudo service apache2 reload
costales@server:~$ telnet smtp.gmail.com 587
Trying 173.194.67.109...
Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP dm2sm7052263wib.8 - gsmtp
Any idea please? Thanks in advance!