S
S
Sergey Sokolov2012-05-31 08:12:38
Exim
Sergey Sokolov, 2012-05-31 08:12:38

How to configure Exim4 to direct all domain mail to PHP script?

There is a fresh Debian with Exim 4, and a domain directed to its ip, where unsubscribes from the mailing list will come, using the List-Unsubscribe headers. There is no experience of configuring Exim or any other MTA.

Unsubscribe addresses are unique according to the pattern [email protected]

How to accept them all and send them to the script?

Two days of fiddling got me thinking about router s, transport s, and pipes .

Created router: and transport: But a test letter to an address of this kind still hangs in the queue (mailq), test php did not write anything to the log file. I did not find any tutu on the topic. I would be very grateful for a step-by-step analysis of the flight or a link to it.
catch_all:
debug_print = "R: catch_all for [email protected]$domain"
driver = accept
domains = unsubscribe.domain.com
transport = unsubscribe_pipe


unsubscribe_pipe:
debug_print = "T: unsubscribe_pipe for [email protected]$domain"
driver = pipe
return_fail_output
path = "/bin:/usr/bin:/usr/local/bin"
command = "/usr/bin/php /var/scripts/unsubscribe.php $local_part"


Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Sokolov, 2012-06-02
@sergiks

As it turned out, the fact is that my changes to the Exim config files were not used. I superficially believed that once I made changes to /etc/exim4/conf.d/..., they would be immediately involved.
It turned out that I missed an important stage of compiling configs using the utility update-exim4.confbeforehand dc_use_split_config='true'in /etc/exim4/update-exim4.conf.conforder to take config files from the directory tree under/etc/exim4/conf.d/

A
a_andry, 2012-05-31
@a_andry

Finger to the sky - the user under which Exim is running must have the rights to execute unsubscribe.php, and write to the log file. Specify the log file with the full path, for the test, shove it somewhere in /tmp/test.log.
For permanent work, instead of writing directly to the log, it is better to use the system syslog.

Y
Yaroslav, 2012-05-31
@xenon

procmail is more sharpened for this, it seems to me. And the task of redirecting a letter to a file or through a pipe to a program is usually signed on the very first page of most procmail tutorials. So use any MTA, Exim or any other, its task is only to accept letters and dump all ansabskribs to a specific user, and then the prokmail (local delivery agent) will decide, according to its simple config, what should be put in mailboxes and what should be given to the script, which will already unsubscribe the sender.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question