我已经很接近了,我发现的所有示例都有帮助。我可以从终端运行 PHP,但无法从收到的电子邮件中运行脚本。
我缺少的部分是让传入的电子邮件连接到 qmail 别名
以获取上下文。我使用的电子邮件位于
[email protected]
服务器的根目录中我创建了一个别名,
/var/qmail/alias
命名
.qmail-bb3k
该别名在 .qmail-bb3k 文件中
|/var/www/vhosts/thatdomain.com/cgi-bin/scrapeAttachment.php
,我运行该文件直接
./.qmail-bb3k: line 1: syntax error near unexpected token `|'
将电子邮件发送到 [email protected] 不执行任何操作,电子邮件成功通过,但 PHP 脚本从未运行。
每次修改脚本时,qmail都会重新启动(不确定是否有必要)。
我可以通过修改 .qmail-bb3k 脚本来运行 PHP 脚本
php /var/www/vhosts/thatdomain.com/cgi-bin/scrapeAttachment.php
,该脚本在从终端运行时有效,我们已经知道这一点,但四倍检查不会损害
我一直引用的链接
http://www.evolt.org/incoming_mail_and_php
http://www.geeksdrafts.net/blog/2011/02/11/sample-qmail-files/
有足够多的活动部件我不确定是否存在简单的语法问题或 bash 和 php 范围之外的问题。
如有任何建议,我们将不胜感激
。
I'm pretty close here, all the examples I have found have been helpful. I can run the PHP from the terminal but cannot get the script to run from a received email.
The part I am missing is getting the incoming email to connect to the qmail alias
for context. the email I am using is
[email protected]
in the root of the server I created an alias in
/var/qmail/alias
the alias is named
.qmail-bb3k
in the .qmail-bb3k file i have
|/var/www/vhosts/thatdomain.com/cgi-bin/scrapeAttachment.php
running that file directly gives me
./.qmail-bb3k: line 1: syntax error near unexpected token `|'
sending an email to [email protected] does nothing, the email makes it through, but the PHP script is never run.
everytime the script is modified, qmail is restarted (not sure if that is necessary.)
i can get the PHP script to run by modifying the .qmail-bb3k script to
php /var/www/vhosts/thatdomain.com/cgi-bin/scrapeAttachment.php
which works when run from the terminal, which we already knew, but quadruple checking doesn't hurt
the links that I've been referencing
http://www.evolt.org/incoming_mail_and_php
http://www.geeksdrafts.net/blog/2011/02/11/sample-qmail-files/
There is enough moving parts that i'm not sure if there is a simple syntax issue or something outside the scope of the bash and php.
any suggestions would be greatly appreciated
t.o.
发布评论
评论(3)
DetDev,回复有点晚了,但您是否意识到每次 MediaTemple 运行 Plesk 更新时,您在此文件夹中创建的 .qmail 文件都会被删除?
当我注意到我的电子邮件管道设置大约每月发生一次故障并且看到 .qmail 文件为空时,我发现了这个问题。
不幸的是,除了手动重新创建文件之外,我还没有找到解决方案。当我无法修复服务器并且消息丢失时,这是相当麻烦的。
DetDev, this is a bit of a late reply but did you realize that the .qmail file you created in this folder will be erased every time MediaTemple runs a Plesk update?
I discovered this problem when I noticed that my email piping setup broke about once a month and saw that the .qmail file was empty.
Unfortunately I have not found an solution to this other than re-creating the file manually. It's quite a hassle when I'm not available to fix the server and messages are lost.
因此,这不是上述具体问题的答案,而是该问题试图实现的目标的替代解决方案。
仅供参考,这是在 Plesk 上,MT 作为托管提供商。不同的服务器,不同的设置YMMV...
简短版本。 我没有使用别名
并在那里创建 .qmail-user,而是转到
该文件夹下的特定用户是 .qmail 文件。当我修改它时,结果是成功的。
感谢@Dagon 让我退后一步并在更高级别进行调试!
干杯,
到
So this is not an answer to the specific question above it is an alternative solution to what this question was trying to accomplish.
FYI, This is on Plesk with MT as the hosting provider. Different servers, different settings YMMV...
Short version. Instead of using an alias under
and creating the .qmail-user there I just went to the specific user under
in that folder is a .qmail file. when I modified that, the outcome is a success.
Thanks to @Dagon for getting me top step back and debug at a higher level!
Cheers,
t.o.
我使用 chmod -i .qmail 解决了 plesk 更新覆盖 .qmail 文件的问题,因此该文件无法更改。自动更新时没有出现任何问题。
i got around plesk updates overwriting the .qmail file using chmod -i .qmail so the file can't be changed. didn't cause any issues when updating automatically.