Re: [exim] Re: copy/unseen - where to plug the code?

Top Pagina
Delete this message
Reply to this message
Auteur: Torsten Mueller
Datum:  
Aan: exim-users
Onderwerp: Re: [exim] Re: copy/unseen - where to plug the code?
Alon schrieb:

...
> Is there a concensous here not to share knowledge?
> Are you (most,. not all) affraid somebody will think less of you if you
> offer assistance here?


... no comment.

...
> Please don't respond unless you address the question that is in the
> subject line.


I am not an Exim guru, but here comes a part of my config.
Possibly it gives a hint, how the problem could be solved.
(If someone else has comments ...)

All users, who send mail through my server auth against
my server. I run MySQL to hold all my email and smtp accounts.
So i have demand for 2 possible "copy" szenarios:
1. mail which is authenticated and is sent out to the world from a user
2. mail which comes from the world for a specific domain/user

1.
Find out, if the mail needs to be shadowed.
I use the $authenticated_id to find this out. In a MySQL table
i hold a mapping between all SMTP accounts and the corresponding
sending domain (table gdns_mail).
Another table holds the domains, which needs to be shadowed.

1.1.
In an ACL set the variable acl_m9, which will be reused in the
routers section. $acl_m9 contains the sending domain then.

warn authenticated = *
         set acl_m9 = ${lookup mysql{select domain from gdns_mail where
    username = '${quote_mysql:$authenticated_id}'} {$value} fail}


1.2.
In the router section test, if the variable contains a "shadow domain".
This test is done against the table, which holds the "target domains".
The router should be one of the first routers.

myshadowroutergdnssmtp:
     condition = ${if eq {} {${lookup mysql {SELECT DISTINCT
    MYSQL_DOMAINFIELD FROM MYSQL_SHADOW_TABLE WHERE
    MYSQL_SHADOW_DOMAIN_FIELD='${quote_mysql:$acl_m9}'}}} {no}{yes}}
     retry_use_local_part
     driver=accept
     unseen
     transport=smtpshadowtransport


1.3.
The transport section. You "save" the mail somewhere, possibly
directly into the mailbox of your boss.

smtpshadowtransport:
driver = appendfile
file = /var/mail/mailbox/of/the/boss
delivery_date_add
envelope_to_add
return_path_add

I myself use
file = /var/mail/shadow/_smtp/$acl_m9/$authenticated_id

2.
In my setup i have a "shadow table", which holds the
information, if a complete domain, or only a specific
e-mail address needs to be shadowed. If one e-mail address needs
to be saved, the domain and localpart field must match.
If a complete domain ... then the localpart field in the
table contains the '@' sign.

2.1.
The routers section contains 2 routers, one for a
single addy, one for a whole domain.

myshadowrouter:
     condition = ${if eq {} {${lookup mysql {SELECT DISTINCT
    MYSQL_DOMAINFIELD FROM MYSQL_SHADOW_TABLE WHERE
    MYSQL_SHADOW_DOMAIN_FIELD='${quote_mysql:$domain}' AND
    MYSQL_SHADOW_LOCALPART_FIELD LIKE
    ${quote_mysql:$local_part}'}}} {no}{yes}}
     retry_use_local_part
     driver=accept
     unseen
     transport=shadowtransport


myshadowrouterwholedomain:
     condition = ${if eq {} {${lookup mysql {SELECT DISTINCT 
MYSQL_DOMAINFIELD FROM MYSQL_SHADOW_TABLE WHERE 
MYSQL_SHADOW_DOMAIN_FIELD='${quote_mysql:$domain}' AND 
MYSQL_SHADOW_LOCALPART_FIELD = '@'}}} {no}{yes}}
     retry_use_local_part
     driver=accept
     unseen
     transport=shadowtransport


2.2.
The transport section uses a transport like shown in 1.3.



Hope that helps.
However you should take again a look at the manual to tweak some
things for your needs. i.e. the errors_to option could be
useful in some cases.

Torsten