Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Archive mail on per smtpd bases and conditional BCC

123 views
Skip to first unread message

sf...@yandex.ru

unread,
Mar 20, 2007, 6:34:59 AM3/20/07
to
I would like to configure postfix so it delivered mail not only to original recipients,
but ALSO to other recipients.
This delivery must be configured based on various parameters:
sender AND recipient AND client ip AND header checks an so on (most like various smtpd restriction).

In my main.cf I have to smtpd - one for INET and another for LAN:
---main.cf--------------------------------------------------------------------------
# INET
195.xxx.xxx.xxx:smtp inet n - n - - smtpd

# LAN
192.168.0.xxx:smtp inet n - n - - smtpd
---main.cf--------------------------------------------------------------------------


Namely I would like to solve two problems:
1. Archive mail on per smtpd(per interface IP) bases:
archive only a mail going from within (LAN) outside (Internet).

- sender_bcc/recipinet_bcc solution lacks:
. operates globally (not per smtpd),
. no_address_mappings (ADDRESS_REWRITING_README) disables not only _bcc, but also virtual alias map,
but I need virtual aliasing
- REDIRECT lacks:
. mail not going to original recipient(s), only to redirected addresses
- procmail/maildrop solutions lacks:
. virtual aliasing don't work with maildrop/procmail
. in case of any maildrop/procmail misconfiguration mail server is unusable (dangerous for me)

2. Deliver copies of messages coming from INTERNET to other addresses
being based on various envelope/header checks.
- sender_bcc/recipinet_bcc solution lacks:
. there is opportunity to CC message based on sender OR recipient only.
I would like CC based on sender AND recipinet AND subject regexp AND so on...
Something like: if sender is jh...@ex.com and recipient is mi...@ds.com and subject is ^Job$ -
deliver message COPY to virtua...@mydomain.com
. operates globally (not per smtpd),
. no_address_mappings (ADDRESS_REWRITING_README) disables not only _bcc, but also virtual alias map,
but I need virtual aliasing
- REDIRECT lacks:
. mail not going to original recipient(s), only to redirected addresses
- procmail/maildrop solutions lacks:
. virtual aliasing don't work with maildrop/procmail
. in case of any maildrop/procmail misconfiguration mail server is unusable (dangerous for me)

I very much would not like to use a maildrop/procmail because virtual aliasing
does not work and at any configuration mistakes mail will not be delivered correctly.

Thanks!

mouss

unread,
Mar 20, 2007, 5:55:25 PM3/20/07
to
sf...@yandex.ru wrote:
> I would like to configure postfix so it delivered mail not only to original recipients,
> but ALSO to other recipients.
> This delivery must be configured based on various parameters:
> sender AND recipient AND client ip AND header checks an so on (most like various smtpd restriction).
>
with:

recipient_bcc_maps = pcre:/etc/postfix/recipient_bcc

# cat recipient_bcc
/(.*)@(.*)/ $1=$2...@copy.example.org

you get a copy of every mail sent via your server, while keeping the
original recipient in the $1 and $2 placeholders.

there is no point to look at To and CC headers. These headers can be
forged, be meaningless (undisclosed recipients) or be outside of your
"juridiction" (an external guys sent mail to another external guy). BCC
should never appear outside if the sender mailer, so in an ideal world,
you have no way of seeing it (*)


(*) some time ago (I don't use eudora since a long time, so I can't
check), eudora had a nasty bug: if you send mail with some recipients in
the bcc field, then if you forward this mail (the one you sent), then
the bcc recipients appear in the forwarded copy. I hope they fixed it.

Victor Duchovni

unread,
Mar 20, 2007, 6:40:35 PM3/20/07
to
On Tue, Mar 20, 2007 at 10:55:25PM +0100, mouss wrote:

> sf...@yandex.ru wrote:
> >I would like to configure postfix so it delivered mail not only to
> >original recipients,
> >but ALSO to other recipients.
> >This delivery must be configured based on various parameters:
> >sender AND recipient AND client ip AND header checks an so on (most like
> >various smtpd restriction).
> >
> with:
>
> recipient_bcc_maps = pcre:/etc/postfix/recipient_bcc
>
> # cat recipient_bcc
> /(.*)@(.*)/ $1=$2...@copy.example.org
>
> you get a copy of every mail sent via your server, while keeping the
> original recipient in the $1 and $2 placeholders.

This is not quite right if the original localpart is quoted. One may
need to special-case the case where the original address starts with a
<"> character.

--
Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:majo...@postfix.org?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.

mouss

unread,
Mar 21, 2007, 12:00:41 PM3/21/07
to
Victor Duchovni wrote:
> On Tue, Mar 20, 2007 at 10:55:25PM +0100, mouss wrote:
>
>
>> sf...@yandex.ru wrote:
>>
>>> I would like to configure postfix so it delivered mail not only to
>>> original recipients,
>>> but ALSO to other recipients.
>>> This delivery must be configured based on various parameters:
>>> sender AND recipient AND client ip AND header checks an so on (most like
>>> various smtpd restriction).
>>>
>>>
>> with:
>>
>> recipient_bcc_maps = pcre:/etc/postfix/recipient_bcc
>>
>> # cat recipient_bcc
>> /(.*)@(.*)/ $1=$2...@copy.example.org
>>
>> you get a copy of every mail sent via your server, while keeping the
>> original recipient in the $1 and $2 placeholders.
>>
>
> This is not quite right if the original localpart is quoted. One may
> need to special-case the case where the original address starts with a
> <"> character.
>
would

/^\"(.*)\"@(.*)/ "$1=$2"@copy.example.org
/(.*)@([^@]+)$/ $1=$2...@copy.example.com

be enough, or are there are other forms to handle?


0 new messages