From: Wietse Venema on
Patric Falinder:
> /etc/postfix/recipient_bcc:
> /@sub\.domain\.com/
> /^(.*)@sub\.domain\.com$/ $1(a)new.sub.domain.com

Wietse Venema skrev 2010-03-29 14:47:
> That first line has no result value.

Patric Falinder:
> What should I set the result value to?
> I got this example from the mailinglist so I didn't make it up my self.

I suppose that someone told you to do this:

if /@sub\.domain\.com/
....stuff...
endif

and then you mis-understood the first line.

If the ...stuff... is only one line, then the if/endif are not
needed.

I think I'm going to change the regexp and pcre table implementations
and disallow rules without result. No other Postfix table allows
that.

Wietse

From: Patric Falinder on
Wietse Venema skrev 2010-03-29 15:00:
> Patric Falinder:
>> /etc/postfix/recipient_bcc:
>> /@sub\.domain\.com/
>> /^(.*)@sub\.domain\.com$/ $1(a)new.sub.domain.com
>
> Wietse Venema skrev 2010-03-29 14:47:
>> That first line has no result value.
>
> Patric Falinder:
>> What should I set the result value to?
>> I got this example from the mailinglist so I didn't make it up my self.
>
> I suppose that someone told you to do this:
>
> if /@sub\.domain\.com/
> ...stuff...
> endif
>
> and then you mis-understood the first line.
>
> If the ...stuff... is only one line, then the if/endif are not
> needed.
>
> I think I'm going to change the regexp and pcre table implementations
> and disallow rules without result. No other Postfix table allows
> that.
>
> Wietse
ah yes I mis-understood it so I changed it as Ansgar said:

/^(.*)@sub\.domain\.com$/ $1(a)new.domain.com

I don't get any errors anymore but I doesn't seem like it want to
deliver to new.sub.domain.com, it only send the mail to sub.domain.com.
Is there a possibility that my content-filter (Maia Mailguard) is
changing something?
Because I can see that both patric(a)new.sub.domain.com and
patric(a)sub.domain.com get sent to the content-filter but only
patric(a)sub.domain.com comes out from there.

Can I do this "re-write" after the content-filter? So my server receives
a mail, send it to my content-filter, my content-filter sends it back to
postfix and then it will "make a copy" as described in recipient_bcc?

Thanks,
Patric

From: Patric Falinder on
Patric Falinder skrev 2010-04-13 11:41:
> Wietse Venema skrev 2010-03-29 15:00:
>> Patric Falinder:
>>> /etc/postfix/recipient_bcc:
>>> /@sub\.domain\.com/
>>> /^(.*)@sub\.domain\.com$/ $1(a)new.sub.domain.com
>>
>> Wietse Venema skrev 2010-03-29 14:47:
>>> That first line has no result value.
>>
>> Patric Falinder:
>>> What should I set the result value to?
>>> I got this example from the mailinglist so I didn't make it up my self.
>>
>> I suppose that someone told you to do this:
>>
>> if /@sub\.domain\.com/
>> ...stuff...
>> endif
>>
>> and then you mis-understood the first line.
>>
>> If the ...stuff... is only one line, then the if/endif are not
>> needed.
>>
>> I think I'm going to change the regexp and pcre table implementations
>> and disallow rules without result. No other Postfix table allows
>> that.
>>
>> Wietse
> ah yes I mis-understood it so I changed it as Ansgar said:
>
> /^(.*)@sub\.domain\.com$/ $1(a)new.domain.com
>
> I don't get any errors anymore but I doesn't seem like it want to
> deliver to new.sub.domain.com, it only send the mail to sub.domain.com.
> Is there a possibility that my content-filter (Maia Mailguard) is
> changing something?
> Because I can see that both patric(a)new.sub.domain.com and
> patric(a)sub.domain.com get sent to the content-filter but only
> patric(a)sub.domain.com comes out from there.
>
> Can I do this "re-write" after the content-filter? So my server receives
> a mail, send it to my content-filter, my content-filter sends it back to
> postfix and then it will "make a copy" as described in recipient_bcc?
>
> Thanks,
> Patric
I looked in to it a little more and it looks like Maia re-writes the
new.sub.domain.com to sub.domain.com.
I get:

/usr/sbin/amavisd-new[22834]: (22834-04) Checking: [62.127.194.20]
<patric.falinder(a)omg.nu> ->
<patric.falinder(a)sub.domain.com>,<patric.falinder(a)sub.domain.com>

When I guess it should be:

/usr/sbin/amavisd-new[22834]: (22834-04) Checking: [62.127.194.20]
<patric.falinder(a)omg.nu> ->
<patric.falinder(a)sub.domain.com>,<patric.falinder(a)new.sub.domain.com>

Maybe this is more of a Maia problem so I will ask there if no one here
knows whats wrong.

Thanks for the help though!
-Patric

From: Mark Martinec on
Patric,

> I looked in to it a little more and it looks like Maia re-writes the
> new.sub.domain.com to sub.domain.com.
> I get:
>
> /usr/sbin/amavisd-new[22834]: (22834-04) Checking: [62.127.194.20]
> <patric.falinder(a)omg.nu> ->
> <patric.falinder(a)sub.domain.com>,<patric.falinder(a)sub.domain.com>
>
> When I guess it should be:
>
> /usr/sbin/amavisd-new[22834]: (22834-04) Checking: [62.127.194.20]
> <patric.falinder(a)omg.nu> ->
> <patric.falinder(a)sub.domain.com>,<patric.falinder(a)new.sub.domain.com>
>
> Maybe this is more of a Maia problem so I will ask there if no one here
> knows whats wrong.

I very much doubt it is the Maia doing a rewrite.
More likely your smtp_generic mapping or masquerading.
Keep in mind that a post-queue content filtered message
goes through Postfix twice.

Mark

From: Patric Falinder on
Mark Martinec skrev 2010-04-13 14:17:
> Patric,
>
>> I looked in to it a little more and it looks like Maia re-writes the
>> new.sub.domain.com to sub.domain.com.
>> I get:
>>
>> /usr/sbin/amavisd-new[22834]: (22834-04) Checking: [62.127.194.20]
>> <patric.falinder(a)omg.nu> ->
>> <patric.falinder(a)sub.domain.com>,<patric.falinder(a)sub.domain.com>
>>
>> When I guess it should be:
>>
>> /usr/sbin/amavisd-new[22834]: (22834-04) Checking: [62.127.194.20]
>> <patric.falinder(a)omg.nu> ->
>> <patric.falinder(a)sub.domain.com>,<patric.falinder(a)new.sub.domain.com>
>>
>> Maybe this is more of a Maia problem so I will ask there if no one here
>> knows whats wrong.
>
> I very much doubt it is the Maia doing a rewrite.
> More likely your smtp_generic mapping or masquerading.
> Keep in mind that a post-queue content filtered message
> goes through Postfix twice.
>
> Mark
I asked at the Maia-list and they said that I should do the "split"
after amavisd-maia processes the message and that I maybe could do
something like this in master.cf:

127.0.0.1:10025 inet n - n - - smtpd
-o content_filter=
-o local_recipient_maps=
[snip]
-o recipient_bcc_maps = regexp:/etc/postfix/recipient_bcc

So I did and restarted postfix, and after that I only get:
"host 127.0.0.1[127.0.0.1] said: 450 4.4.1 Can't connect to localhost
port 10025"
I tried manually telnet to port 10025 but it didn't work, I checked in
netstat if something was listening to port 10025 and there was..

This is how it looks in my master.cf, only pasted the 10025 part:

127.0.0.1:10025 inet n - - - - smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_delay_reject=no
-o smtpd_client_restrictions=permit_mynetworks,reject
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks_style=host
-o mynetworks=127.0.0.0/8,10.0.0.0/24
-o strict_rfc821_envelopes=yes
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0
-o smtpd_client_connection_rate_limit=0
-o
receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_address_mappings

Is it not possible to add "-o recipient_bcc_maps =
regexp:/etc/postfix/recipient_bcc" in master.cf? How should I do to make
the "split" after maia has processed the message if this doesn't work?


Thanks,
Patric