简体   繁体   English

使用Exim中的管道进行邮件路由

[英]Mail Routing using pipe in Exim

I was looking for sending email to multiple destinations ie One to the user specified email address and other to a php script. 我正在寻找向多个目的地发送电子邮件,即一个用户指定的电子邮件地址,另一个用于PHP脚本。 Surfing over the web, I concluded that I have to use pipe in routers and transfer configurations of my mailing agent ie Exim in my case. 通过网络浏览,我得出结论,我必须在路由器中使用管道并传输我的邮件代理的配置,即我的情况下的Exim。 I tried but failed to embed pipe transfer in my Exim configurations. 我尝试但未能在我的Exim配置中嵌入管道传输。 Server results in failing pipe transfer. 服务器导致管道传输失败。 Need help in getting this issue fixed. 需要帮助才能解决此问题。 I modified my exim.cnf file as: 我修改了我的exim.cnf文件:

############ ROUTERS
system_aliases:
driver = accept 
domains = **.**.**.**(my Domain) 
transport = use_pipe

############ TRANSPORT
use_pipe:
debug_print = "Using Pipe Transport"
driver = pipe
command = /etc/script.php
return_path_add
delivery_date_add
envelope_to_add
return_output

where script.php is the second destination where I want to send the file. 其中script.php是我想要发送文件的第二个目的地。 Here are the Logs: 这是日志:

 3402   uid=3000 gid=3000 pid=3402
 3402   auxiliary group list: 3000
 3402   home=NULL current=/
 3402 set_process_info:  3402 delivering 1ZTPOU-0000sn-JB to abc using use_pipe
 3402 Using Pipe Transport
 3402 use_pipe transport entered
 3402 direct command:
 3402   argv[0] = /etc/testScript.php
 3402 direct command after expansion:
 3402   argv[0] = /etc/testScript.php
 3402 Writing message to pipe
 3402 writing data block fd=10 size=44 timeout=3600
 3402 writing data block fd=10 size=2048 timeout=3600
 3402 writing data block fd=10 size=1 timeout=3600
 3404 set_process_info:  3404 reading output from |/etc/testScript.php
 3402 use_pipe transport yielded 2
 3402 search_tidyup called
 3399 use_pipe transport returned FAIL for abc@myDomain
 3399 post-process abc@myDomain (2)
 3399 LOG: MAIN
 3399   ** abc@myDomain R=system_aliases T=use_pipe: Child process of use_pipe transport returned 127 (could mean unable to exec or command does not exist) from command: /etc/testScript.php

*testScript is present at the exact location specified in logs. * testScript出现在日志中指定的确切位置。

In routers section I wrote my own custom router that will deliver email to my desired php script. 在路由器部分,我编写了自己的自定义路由器,将电子邮件发送到我想要的PHP脚本。 In transport section wrote my own custom transport that will ensure delivery to the desired script using curl. 在传输部分写了我自己的自定义传输,将确保使用curl传递到所需的脚本。 Kept the system_aliases section in Routers configuration as it is but changed driver from accept to redirect .Wrote the following configurations in my /etc/exim.cnf file: 保持system_aliases在路由器配置部分,因为它是,但改变驾驶员acceptredirect .Wrote在我下面的配置/etc/exim.cnf文件:

############ROUTERS
runscript:
        driver = accept
        transport = run_script
        unseen
        no_expn
        no_verify
############TRANSPORT
run_script:
     debug_print = "T: run_script for $local_part@$domain"
     driver = pipe
     command = /home/bin/curl http://my.domain.com/mailTest.php --data-urlencode $original_local_part@$original_domain

mailTest.php was my php script mailTest.php是我的php脚本

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

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