运行电子邮件列表脚本时,来自Cron Daemon的额外电子邮件 [英] Extra email from Cron Daemon when running an email list script
问题描述
我有一个PHP脚本,向订阅者发送每两周一次的提醒。每次发送电子邮件,它也发送一个电子邮件从Cron守护进程。当我第一次写脚本,它没有发送这封电子邮件,但现在它。我有几个问题。
I have a PHP script that sends out a bi-weekly reminder to subscribers. Each time it sends out the email it also sends out an email that comes in from "Cron Daemon." When I first wrote the script, it didn't send this email, but now it does. I have a few questions about this.
这是电子邮件说的:
Set-Cookie: PHPSESSID=((random letters and numbers here)); path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html
- 此电子邮件是什么意思?
- 为什么会发送此电子邮件?
- 从发送此电子邮件?
推荐答案
Cron读取执行的命令的stdout / stderr ,如果有东西写了,然后cron发送电子邮件。
Cron reads the stdout/stderr of the command that gets executed, if something is written then cron sends an E-Mail.
我想这个php可执行文件被编译为cgi或fcgi,所以它默认发出这些头。
I guess the php-executable is compiled as "cgi" or "fcgi" so it emits those headers by default.
要解决这个问题,您显然有三种可能的解决方案:
To solve this you have apparently three possible solutions:
- 使用PHP的cli版本
- 将stderr和stdout重定向到/ dev / null(这意味着将cron命令附加
> / dev / null 2>& 1
)。 li>
- 定义
MAILTO =
(参见此页)。
- Use the "cli" version of PHP
- Redirect stderr and stdout to /dev/null (that means append
> /dev/null 2>&1
to your cron command). - Define
MAILTO=""
(see this page).
这篇关于运行电子邮件列表脚本时,来自Cron Daemon的额外电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!