[exim] acl-content and outgoing mail

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Nils Sandmann
Datum:  
To: exim-users
Betreff: [exim] acl-content and outgoing mail
Hello,

To describe my problem I briefly outline my exim configuration first.

I've got exim running on my virtual rootserver for some weeks and I'm
still tweaking the spamassassin configuration.

My goal was to support per-user spamassassin configuration but still
doing the spam checking in acl. I encountered the multiple recipient
email problem but didn’t want to reject mails with more than one. So I
decided to scan mails with one recipient using a per-user spamassassin
configuration and mails with multiple recipients with a generic one
without Bayesian filtering. Then a problem occurred because I also
configured a catchall address. At acl time it is of course yet undecided
to which user an email will be locally delivered. But I have a small
scale setup and I just decided to lookup in a mysql table if the
localpart equals a virtual user in my system. If it is the case per-user
spam scanning is done, if not, a generic profile is used.

But I’d like to mark an email in the subject in this case. And this is
my problem. My idea was just to do the following.

In acl-content:

warn message = X-New-Subject: *UNKNOWN RECIPIENT* $h_subject:
     condition = ${lookup mysql{SELECT user_id FROM users WHERE username
= '$recipients'}{0}{1}}


In a system filter:

if "${if def:header_X-New-Subject: {there}}" is there
then
headers remove Subject
headers add "Subject: $h_X-New-Subject:"
headers remove X-New-Subject
endif

That works for incoming mail. Emails which had to be scanned with the
generic profile were marked.

But I’m also using this system as an outgoing smtp server from my home
pc. (using smtp-auth)

I was happy with that until I discovered that every *outgoing* mail was
also marked.

I didn’t realize that this worked this way also. Well of course, the
recipient address is not known for outgoing mail. I have to admit that
I’m not an expert in exim and the smtp protocol, still learning  (I
wondered if the entire code in acl-content is executed not only for
incoming but also for outgoing mail, how is spam checking avoided for
outgoing mail for example?)

Has anyone a hint how to deal with this or am I totally stuck with my
self-made solution?

Many thanks and greetings,
Nils Sandmann