dongqindan4406 2013-01-11 11:59
浏览 89
已采纳

PHP mail()返回false日志为空

I have installed apache with PHP Version 5.3.3-7+squeeze14 and I can't get mail to work, this is the code i'm using:

error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 1);
echo 'I am : ' . `whoami`;
$result = mail('*****','Testing 1 2 3','This is a test.');
echo '<hr>Result was: ' . ( $result === FALSE ? 'FALSE' : 'TRUE') . $result;
echo '<hr>';
echo phpinfo();

this is response I get:

I am : www-data
Result was: FALSE

In my php.ini i have edited two lines, this is how hey look right now:

sendmail_path = /usr/sbin/sendmail -t -i -f something@****.lt
sendmail_from = something@****.lt

/var/log/mail.log is completely empty even thou I have been trying various things for over an hour now.

I'm fairly new to linux so i'm pretty sure that I'm missing something obvious just can't seem to find in...

EDIT Forgot to mention that i do restart apache every time i make some changes to my configuration, and I'm using Debian 6.0

  • 写回答

2条回答 默认 最新

  • douqu8828 2013-01-11 12:08
    关注

    You need to install postfix or sendmail (Postfix would be preferred)

    The php mail() function needs an MTA in any way.

    Or you can use the complicated way and script an smtp Mailclass: email.about.com/od/emailprogrammingtips/qt/…

    Or you can use phpmailer: phpmailer.worxware.com.

    But to be able to use mail() you need an mta (Aka postfix or sendmail)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?