Re: [exim] Filtering e-mail by subject and redirecting to a …

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Thomas Gericke
Fecha:  
A: exim-users
Cc: Thomas Gericke
Asunto: Re: [exim] Filtering e-mail by subject and redirecting to a pipe
Hi Magnus,

Magnus Holmgren wrote:

> On Monday 23 October 2006 10:30, Thomas Gericke took the opportunity to say:
> > | begin routers
> > |
> > | test_subject_router:
> > |         driver = redirect
> > |         allow_filter
> > |         file = /etc/exim4/filtersubject
> > |         user = mail
> You need a pipe_transport here.


Okay, nice idea, I added that, BUT:

When delivering such an e-mail to the host, the pipe_transport is obvious-
ly not used. See log:

One mail with "wrong" subject:

| 2006-10-23 11:49:08 1GbwQe-0001dP-A5 <= thomas@??? H=mail03.noris.net 
|    [62.128.1.223] P=esmtp S=3086 id=20061023094743.GI12225@??? 
|    T="test"
| 2006-10-23 11:49:08 1GbwQe-0001dP-A5 => thomas <thomas@???> R=localuser 
|   T=local_delivery
| 2006-10-23 11:49:08 1GbwQe-0001dP-A5 Completed


And one with the right one:

| 2006-10-23 11:49:26 1GbwQw-0001dY-7k <= thomas@??? H=mail03.noris.net 
|    [62.128.1.223] P=esmtp S=3106 id=20061023094801.GJ12225@??? 
|    T="blubberdiblubb"
| 2006-10-23 11:49:26 1GbwQw-0001dY-7k => thomas <thomas@???> R=localuser 
|    T=local_delivery
| 2006-10-23 11:49:26 1GbwQw-0001dY-7k Completed


The transport "local_delivery" is used, although my test router is the first
one in the main configuration file.

> > ... /etc/exim4/filtersubject:
> > | # Exim filter
> > | if error_message then
> > |         finish
> > | endif
> > | if $h_subject: contains "blahblahblah" then
> > |         pipe /path/to/script
> > | endif

> >
> > When an e-mail arrives, nothing more happens than "normal" and local
> > delivery.


The filter itself should work, as testing reports:

| {12:15PM root@minuten:/root} # exim4 -bf /etc/exim4/subjectfilter -d-all+filter </tmp/blubbermail 
| Exim version 4.50 uid=0 gid=0 pid=8988 D=200
| Berkeley DB: Sleepycat Software: Berkeley DB 4.2.52: (December  3, 2003)
| Support for: iconv() IPv6 PAM Perl GnuTLS Content_Scanning Old_Demime
| Lookups: lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmnz dnsdb dsearch ldap ldapdn ldapm mysql nis nis0 passwd pgsql
| Authenticators: cram_md5 cyrus_sasl plaintext spa
| Routers: accept dnslookup ipliteral iplookup manualroute queryprogram redirect
| Transports: appendfile/maildir/mailstore/mbx autoreply lmtp pipe smtp
| Fixed never_users: 0
| configuration file is /etc/exim4/exim4.conf
| log selectors = 00000ffc 00028800
| trusted user
| admin user
| Sender taken from "From " line
| Return-path taken from "Return-path:" header line
| Return-path = thomas@???
| Sender      = thomas@???
| Recipient   = root@???
| Testing Exim filter file "/etc/exim4/subjectfilter"
| 
| Condition is false: error_message
| Condition is true: $header_subject: contains blubberdiblubb
| Save message to: /tmp/blubberdiblubb
| Filtering set up at least one significant delivery or other action.
| No other deliveries will occur.
|   >>>>>>>>>>>>>>>> Exim pid=8988 terminating with rc=0 >>>>>>>>>>>>>>>>


Still in need of help :-)

    Thomas
-- 
 ..:: Thomas Gericke :: "Live every day as if it were your last" ::..
   :: <mailto:thomas@thomasgericke.de>
   :: <http://www.thomasgericke.de/>
-- 
 "So, I poured another strong one 
  And chopped a line from here to Texas 
  Cause I've lost another good one 
  She's on the midnight train to Memphis"