This option sets up a filtering (in the Unix shell sense) process for messages
at transport time. It should not be confused with mail filtering as set up by
individual users or via a system filter.
+.new
+If unset, or expanding to an empty string, no filtering is done.
+.wen
When the message is about to be written out, the command specified by
&%transport_filter%& is started up in a separate, parallel process, and
JH/15 Bug 1712: Introduce $prdr_requested flag variable
+JH/16 Bug 1714: Permit an empty string as expansion result for transport
+ option transport_filter, meaning no filtering.
+
Exim version 4.86
-----------------
/* If there is no filter command set up, call the internal function that does
the actual work, passing it the incoming fd, and return its result. */
-if (transport_filter_argv == NULL)
+if ( !transport_filter_argv
+ || !*transport_filter_argv
+ || !**transport_filter_argv
+ )
return internal_transport_write_message(addr, fd, options, size_limit,
add_headers, remove_headers, check_string, escape_string,
rewrite_rules, rewrite_existflags);
+1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@test.ex U=CALLER P=local S=sss
+1999-03-02 09:44:33 10HmaX-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
+1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@test.ex U=CALLER P=local S=sss
1999-03-02 09:44:33 10HmaY-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
-1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@test.ex U=CALLER P=local S=sss
-1999-03-02 09:44:33 10HmaX-0005vi-00 == userx@test.ex R=r1 T=t1 defer (-24): transport filter process failed (127) while writing to TESTSUITE/test-mail/userx: unable to execute command
+1999-03-02 09:44:33 10HmaZ-0005vi-00 <= CALLER@test.ex U=CALLER P=local S=sss
+1999-03-02 09:44:33 10HmaZ-0005vi-00 => userx <userx@test.ex> R=r1 T=t1
+1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed
+From CALLER@test.ex Tue Mar 02 09:44:33 1999
+Received: from CALLER by the.local.host.name with local (Exim x.yz)
+ (envelope-from <CALLER@test.ex>)
+ id 10HmaX-0005vi-00
+ for userx@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaX-0005vi-00@the.local.host.name>
+From: CALLER_NAME <CALLER@test.ex>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+
+Testing with filter
+
From CALLER@test.ex Tue Mar 02 09:44:33 1999
Received: from CALLER by the.local.host.name with local (Exim x.yz)
(envelope-from <CALLER@test.ex>)
From: CALLER_NAME <CALLER@test.ex>
Date: Tue, 2 Mar 1999 09:44:33 +0000
-Testing with filter
+Testing without filter
+
+From CALLER@test.ex Tue Mar 02 09:44:33 1999
+Received: from CALLER by the.local.host.name with local (Exim x.yz)
+ (envelope-from <CALLER@test.ex>)
+ id 10HmaZ-0005vi-00
+ for userx@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaZ-0005vi-00@the.local.host.name>
+From: CALLER_NAME <CALLER@test.ex>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+
+Testing with expand-to-empty filter
+++ /dev/null
-1999-03-02 09:44:33 Received from CALLER@test.ex U=CALLER P=local S=sss
-1999-03-02 09:44:33 userx@test.ex R=r1 T=t1 defer (-24): transport filter process failed (127) while writing to TESTSUITE/test-mail/userx: unable to execute command
+++ /dev/null
-1999-03-02 09:44:33 10HmaX-0005vi-00 == userx@test.ex R=r1 T=t1 defer (-24): transport filter process failed (127) while writing to TESTSUITE/test-mail/userx: unable to execute command
'optional_ocsp' =>
{ 'stderr' => '/127.0.0.1 in hosts_requ(ire|est)_ocsp/' },
- 'no_tpt_filter_epipe' =>
- { 'stderr' => '/^writing error 32: Broken pipe$/' },
-
'optional_cert_hostnames' =>
{ 'stderr' => '/in tls_verify_cert_hostnames\? no/' },
# empty transport filter
#
-munge no_tpt_filter_epipe
-#
exim -d-all+transport -odi userx
Testing with filter
****
exim -DFILTER= -d-all+transport -odi userx
Testing without filter
****
+exim -DFILTER='${if={1}{1}{}{}}' -d-all+transport -odi userx
+Testing with expand-to-empty filter
+****
mailbox TESTSUITE/test-mail/userx is locked
writing to file TESTSUITE/test-mail/userx
writing data block fd=dddd size=sss timeout=0
-process pppp running as transport filter: write=dddd read=dddd
writing data block fd=dddd size=sss timeout=0
-process pppp writing to transport filter
-copying from the filter
-waiting for filter process
-filter process returned 127
-waiting for writing process
-end of filtering transport writing: yield=0
-errno=-24 more_errno=dd
-appendfile yields 10 with errno=-24 more_errno=dd
-t1 transport returned PANIC for userx@test.ex
-LOG: MAIN PANIC
- == userx@test.ex R=r1 T=t1 defer (-24): transport filter process failed (127) while writing to TESTSUITE/test-mail/userx: unable to execute command
+writing data block fd=dddd size=sss timeout=0
+appendfile yields 0 with errno=dd more_errno=dd
+t1 transport returned OK for userx@test.ex
+LOG: MAIN
+ => userx <userx@test.ex> R=r1 T=t1
+LOG: MAIN
+ Completed
+>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
+Exim version x.yz ....
+configuration file is TESTSUITE/test-config
+admin user
+LOG: MAIN
+ <= CALLER@test.ex U=CALLER P=local S=sss
+Exim version x.yz ....
+configuration file is TESTSUITE/test-config
+trusted user
+admin user
+>>>>>>>>>>>>>>>> Local deliveries >>>>>>>>>>>>>>>>
+--------> userx@test.ex <--------
+direct command:
+ argv[0] = ${if={1}{1}{}{}}
+direct command after expansion:
+ argv[0] =
+appendfile transport entered
+appendfile: mode=600 notify_comsat=0 quota=0 warning=0
+ file=TESTSUITE/test-mail/userx format=unix
+ message_prefix=From ${if def:return_path{$return_path}{MAILER-DAEMON}} ${tod_bsdinbox}\n
+ message_suffix=\n
+ maildir_use_size_file=no
+ locking by lockfile fcntl
+lock name: TESTSUITE/test-mail/userx.lock
+hitch name: TESTSUITE/test-mail/userx.lock.test.ex.dddddddd.pppppppp
+lock file created
+mailbox TESTSUITE/test-mail/userx is locked
+writing to file TESTSUITE/test-mail/userx
+writing data block fd=dddd size=sss timeout=0
+writing data block fd=dddd size=sss timeout=0
+writing data block fd=dddd size=sss timeout=0
+appendfile yields 0 with errno=dd more_errno=dd
+t1 transport returned OK for userx@test.ex
+LOG: MAIN
+ => userx <userx@test.ex> R=r1 T=t1
+LOG: MAIN
+ Completed
>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Exim pid=pppp terminating with rc=0 >>>>>>>>>>>>>>>>