PHP sendmail的工作在Ubuntu的命令行,但不能从一个PHP文件 [英] PHP sendmail works in Ubuntu command line, but not from a php file

查看:277
本文介绍了PHP sendmail的工作在Ubuntu的命令行,但不能从一个PHP文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装sendmail的PHP和Apache在Ubuntu。当我尝试使用以下命令行

I installed sendmail with PHP and apache on Ubuntu. When I try the following command-line

php -r "mail('test@gmail.com', 'test', 'test')"'

它成功地发送电子邮件。

it successfully sends the email.

然而,运行文件test_send_mail.php有:

However, running the file "test_send_mail.php" with:

<?php
mail('test@gmail.com', 'test', 'test')
?>

不发送电子邮件。

doesn't send an email.

随着PHP文件的失败尝试生成的日志条目:

The unsuccessful attempt with the .php file generates the log entry:

`Jul  5 21:24:47 www sendmail[25603]: p661OlL7025603: from=www-data, size=106, class=0,

nrcpts = 0,MSGID =&LT; 201107060124.p661OlL7025603@www.server.com>,继电器= www数据@本地

nrcpts=0, msgid=<201107060124.p661OlL7025603@www.server.com>, relay=www-data@localhost

在命令行的成功尝试生成的日志条目:

The successful attempt with the command line generates the log entry:

    Jul  5 21:22:40 www sm-mta[25533]: p661MevV025533: from=<root@www.server.com>, 
size=352, class=0, nrcpts=1, msgid=<201107060122.p661Mecm025532@www.server.com>, 
proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]

没有人有任何想法可能发生?谢谢您的帮助!

Does anyone have any idea what might be happening? Thank you for your help!

推荐答案

也许你的系统prevents发送邮件的Apache。看到这个类似的问题:

Maybe your system prevents apache from sending a mail. See this similar question:

http://stackoverflow.com/a/1467900/956397

这篇关于PHP sendmail的工作在Ubuntu的命令行,但不能从一个PHP文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆