RE: [Exim] Usage of .forward with Exim and Procmail

Top Page
Delete this message
Reply to this message
Author: Arnulv Rudland
Date:  
To: exim-users
CC: 'Harald Hoellerl'
Subject: RE: [Exim] Usage of .forward with Exim and Procmail
On Friday, November 29, 2002 6:47 PM, Harald Hoellerl said:
>
>
> Hi all,
>
> I'm not aware whether this topic was already discussed within
> this group, because I'm very new with Debian Linux.
>
> I'm also not sure whether my question either belongs to procmail
> or to exim.
>
> The default mailer on a Debian Linux system is exim.
> Exim uses procmail as transport when the file $HOME/.procmailrc
> exists. There is no need to start procmail via the $HOME/.forward
> file as frequently described in dedicated FAQ's.


This part of the faq should be altered: I've stumbeled over teh same thing
too

>
> Before setting up procmail, I used $HOME/.forward to forward
> my private email to my companies mail account. Because I've recently
> subscribed to some mailing lists, my mail traffic has
> increased very much.
>
> My intension was, to filter out the messages directed to
> mailing lists and
> copy them to dedicated directories. The remaining mails,
> which do not match
> to the maillist filters should be delivered as usual to
> /var/mail/<user>
> and also should be forwarded to my companies mail account.
>
> What I could observe is, that all the email to the maillists is copied
> correctly
> to the intended files/directories and the remaining mail is
> delivered as
> usual
> to /var/mail/<user>.
>
> But ALL mail messages are forwarded to my company, because my
> companies
> email address is still in $HOME/.forward. My expectation was
> that only the
> remaining email, which does not match to any procmail filter, is being
> forwarded
> via ~/.forward. But this is obviously not true.
>
> Do I have to do forwarding within procmail and deleting ~/.forward to
> prevent
> that all email is forwarded.
>
> Does anybody have an idea about this?
> Is the forwarding done by procmail or by exim?


I'm doing nearly the same thing:

My solution:

1) No .forward
2) .procmailrc-receipts taking care of the mailing list entries which I
don't want to forward:

:0H
*^X-Mailinglist:
!local-maililnglist-user

Note the lacking of the 'c' flag in the header: those mails are moved, not
copied. I use another local user for the mailing list. Note that not all
mailing lists use the 'X-Mailinglist flag

3) A receipet at the end of .procmailrc, that with a list of exclusive regex
staements filters out which messages I want to forward, here a simplified
version:

:0Hc
* !Return-path: \<nonforward-local-user\>
* !Return-path: .*\my-employer\.com
* !From: me\@my-employer\.com
* !^FROM_MAILER
!me@???

# Explanation:
- the 1st receipte filters out system-internal mails from a dedicated user
from being forwarded
- the 2nd and third lines filters out mails from my employer domain
- the 4th line filters out mails from myself to stop infinite loops

This seems to work qiute well.

Regards

Arnulv