Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29935

Sending mail through terminal using msmtp works fine, but doesn't work with php mail()

$
0
0

Recently I installed msmtp on my ubuntu 12.04 server that is running the kubuntu desktop. The install of msmtp worked fine, and I can even send mail through the terminal using gmail's smtp server.

My problem is that although sending mail works through the terminal, it still doesn't work with php mail. I have tried using the php mail() function, but I never receive any email.

I have checked the apache error logs (/var/log/apache2/error.log), but they are empty.
Does anyone know how to fix this? If any further information is needed, just say so :)

Also when executing the php script, no errors appear.

The code below echos Mail Sent, but I never recieve an email:

<?
if(mail( 'noreply.njmedia@gmail.com', 'Test mail from localhost', 'Working Fine.'))
{
    echo 'Mail sent';
}
else
{
    echo 'Error. Please check error log.';
}
?>

Viewing all articles
Browse latest Browse all 29935

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>