但不能从一个PHP文件

但不能从一个PHP文件

本文介绍了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('[email protected]', 'test', 'test')"'

它成功地发送电子邮件。

it successfully sends the email.

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

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

<?php
mail('[email protected]', '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; [email protected]>,继电器= www数据@本地

nrcpts=0, msgid=<[email protected]>, 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=<[email protected]>,
size=352, class=0, nrcpts=1, msgid=<[email protected]>,
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:

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

07-23 18:05