Re: [exim] Looking for possibility to filter maillists

Etusivu
Poista viesti
Vastaa
Lähettäjä: Bill Hacker
Päiväys:  
Vastaanottaja: exim
Aihe: Re: [exim] Looking for possibility to filter maillists
Stan Novogroudski wrote:

> Dear Sirs.
> Sorry about my English.


Nuthin' wrong wit it so far.... ;-)

>
>
> I am looking for possibility to filter mails, coming from mail lists
> thrue my exim. I am using Exim4. What I will is:
> my exim must register that incoming mail is from mail list, and route it
> thrue extra delivery (IMAP-delivery). I can not use sieve, because I
> can't handle sieve-scripts dynamicly. $home/.forward isn't going to,
> because I have not physical users on this host. My users are only
> LDAP-users.
> My idea was to handle this about EXIM-ACL's, but i didn't found some
> Information about a possibility to handle Routers with ACL.


One way is to have a (several) specialized router(s) that look for a header.
The header may be one already present on the incoming traffic (dodgy) or
one you add in an acl for the purpose.

> A scenario have to be something like that:
>
> 1. Mail comes in. Exim register, thrue a header-information, that this
> mail comes from maillinglist.


Not necessarily by itself 100% reliable - you are at the mercy of the
list maintainer(s), and different MLM's and configs will send with
different headers. Not all such traffic is even easily ID'ed as from a list.

You will probably want to set up a list of 'patterns' AND of sources, do
one or more search/lookups against the list, and
add an appropriate header of you own for consistency.

You may also choose to strip the header after you have used it to invoke
the appropriate router(s).

> 2. The localpart of maillinglist have to be matched. Exmpl:
> maillist@??? -> $maillist set to a variable.
> 3. Mail have to be routed thrue a normal router end deliver to extra
> delivery like that:
> command = /usr/cyrus/bin/deliver -m ${$user.user.:$maillist} -- $local_p
> art
>
> Is it possible?


In any of several ways.

Here is a sample acl and router (untested, but similar to something else
we do that works well)

An acl:

  warn
     condition   = ${lookup {$<your choice of a reliable MLM indication 
for list 'a'>} lsearch{/var/mail/REGEXP-MLM}{yes}{no}}
    message     = X-MLMA Mailing List Traffic from List <a>.


and a router and transport to respond to it:

# Sample router:
#
mlm_router_a:
   driver    = accept
   transport = mlm_a_delivery
   condition = "${if def:header_X-MLMA:{1}{0}}"
# unseen
# uncomment the 'unseen' if this is not the last part of a 
multi-route/transport set and
follow it with more router code if you wish to make multiple deliveries 
or place a shared/archive copy somewhere else, such as on a web page.


#Sample Transport
#
mlm_a_delivery:
driver = appendfile
user = exim
group = mail
delivery_date_add
envelope_to_add
return_path_add
maildir_format = true
mode = 0700
directory =
/data/mail/{domain}/{localpart}/Maildir/{mailing_list_a_inbox}
create_directory = true
directory_mode = 0700
no_mode_fail_narrower

- Not as 'clean' as it could be (defaults are good enough for some of
the above code, my 'production' settings may differ)
and by no means directly usable as is, but hopfully may give you some
ideas....

If posting a copy to a local web page, mbox format may be more suitable
than Maildir.
Exim can mix and match.

Bill





>
> Thanks for Your help.
>