如何在PHP中使用Procmail? [英] How do I use Procmail with PHP?

查看:123
本文介绍了如何在PHP中使用Procmail?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用procmail将电子邮件发送到PHP脚本,以便该脚本将检查MySQL数据库并根据发件人电子邮件编辑主题行.我相信我有一个有效的procmail可以做到这一点:

I'm trying to use procmail to send emails to a PHP script so the script will check a MySQL database and edit the subject line based on the sender email. I believe I've got a working procmail to do this:

:0:
* ^To:.*@barrett.com
! '/usr/local/bin/php-5.2 -f $HOME/ticket/emailcustcheck.php'

但是,我不确定procmail是如何执行命令的.电子邮件如何传递到PHP脚本,因此,如何在脚本中引用电子邮件?

However, I'm not sure exactly how procmail executes the command. How does the email get passed to the PHP script, and therefore, how do I refer to it inside the script?

推荐答案

:0 wf
* ^To:.*@barrett\.com
| /usr/local/bin/php-5.2 -f $HOME/ticket/emailcustcheck.php

f 告诉procmail您将要过滤消息,即对其进行更改. w 等待过滤器或程序完成并检查其退出代码.

The f tells procmail that you are going to filter the message ie change it. The w Wait for the filter or program to finish and check its exitcode.

如果只想处理邮件正文,则必须添加标志 b 如果只想处理邮件的标题,则必须添加标志 h

If you want to work only on the body of the message you must add the flag b If you want to work only on the header of the message you must add the flag h

这篇关于如何在PHP中使用Procmail?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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