简体   繁体   English

Exim&WHM-在邮件拒绝时运行PHP脚本

[英]Exim & WHM - Run PHP Script on mail rejection

I wrote a script to reject emails if they have zip attachments containing exe, js files..etc etc.. It worked successfully. 我写了一个脚本来拒绝电子邮件,如果它们有包含exe,js文件等的zip附件。 I wrote the following script under acl_smtp_mime at WHM Exim Advanced Editor: 我在WHM Exim高级编辑器的acl_smtp_mime下编写了以下脚本:

deny message = "This message might contain harmful files."
condition = ${if match{$mime_filename}{\N(?i)\.zip$\N}}
decode = default
condition = ${if match{${run{/usr/bin/unzip -l $mime_decoded_filename}}} {\N(?i)\.(com|js|pif|scr|lnk|exe)\n\N} }

I am trying to execute a PHP script that inserts a log entry in the databse regarding the rejected email but I failed. 我正在尝试执行一个PHP脚本,该脚本在数据库中插入有关拒绝的电子邮件的日志条目,但失败了。

I tried inserting this line at the end but it failed to run the script 我尝试在最后插入此行,但无法运行脚本

continue = ${run{/usr/bin/php '/home/*hidden*/public_html/test.php $mime_decoded_filename'}{0}{1}}

When I run the PHP from the browser just for testing, it runs fine and creates a fake log. 当我从浏览器运行PHP进行测试时,它运行良好并创建了伪造的日志。 It seems I'm not calling the script correctly from EXIM. 看来我没有从EXIM正确调用脚本。 Emails are rejected successfully but the PHP file is not getting called 电子邮件被成功拒绝,但未调用PHP文件

Please help. 请帮忙。 Thank you 谢谢

I don't think exim knows how to execute .php scripts. 我认为exim不知道如何执行.php脚本。 You could try to port that php script to perl. 您可以尝试将php脚本移植到perl。 Exim on a cPanel/WHM server, by default, has the ability to run perl scripts. 默认情况下,在cPanel / WHM服务器上的Exim能够运行perl脚本。 You might want to read exim documentation though regarding the php scripts... 您可能想阅读exim文档,尽管有关php脚本...

我能够使用curl运行我的php脚本:

continue = ${run{/usr/bin/curl http://www.*****.com/test.php?fn=$mime_filename&sa=$sender_address&rf=$recipients}}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM