我正在寻找发送电子邮件到多个目的地,即一个用户指定的电子邮件地址,另一个用于PHP脚本.通过网络浏览,我得出结论,我必须在路由器中使用管道并转移我的邮件代理的配置,即我的情况下的Exim.我尝试但未能在我的Exim配置中嵌入管道传输.服务器导致管道传输失败.需要帮助才能解决此问题.
我修改了我的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
其中script.PHP是我想要发送文件的第二个目的地.
这是日志:
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出现在日志中指定的确切位置.
解决方法:
在路由器部分,我编写了自己的自定义路由器,将电子邮件发送到我想要的PHP脚本.在传输部分写了我自己的自定义传输,将确保使用curl传递到所需的脚本.保持路由器配置中的system_aliases部分不变,但将驱动程序从accept更改为redirect.在我的/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
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。