Same address delivering to multiple mailboxes

2009-11-20 Thread Sean Holdsworth

This is by way of a sanity check; I believe something is not possible to
do in Postfix without resorting to external code, but would be very  
pleased

if I was proved wrong.

Suppose I have a catchall delivery for a (virtual) domain into a  
mailbox:


   @domain => A

I also have a couple of other addresses in the same domain delivering to
their own mailboxes:

   p...@domain => B
   p...@domain => C

So far so good, easy to set up and things work as expected. Now for the
complication. In addition to the fully qualified addresses delivering to
their own mailboxes I require a copy of this mail delivered into the
catchall mailbox:

   p...@domain => B, A
   p...@domain => C, A

Now, providing I'm prepared to do an address rewrite I can set this up  
as

follows:

virtual_alias_maps = hash:virtual_aliases
virtual_mailbox_maps = hash:virtual_mailbox_recipients

virtual_aliases:
p...@domain p...@domain catch...@domain
p...@domain p...@domain catch...@domain

virtual_mailbox_recipients:
@domain A
p...@domain B
p...@domain C

The problem is that I don't want to see that rewrite to  
catch...@domain being
done, because of just one more little complication. Instead of  
delivering to
mailbox A, I want mail that would arrive there sent on to another MTA,  
so my

configuration looks like this:

virtual_alias_maps = hash:virtual_aliases
virtual_mailbox_maps = hash:virtual_mailbox_recipients
transport_maps = hash:transport

virtual_aliases:
p...@domain p...@domain catch...@domain
p...@domain p...@domain catch...@domain

virtual_mailbox_recipients:
@domain OK
p...@domain B
p...@domain C

transport:
domain smtp:[MTA]
p...@domain virtual
p...@domain virtual

If I allow that address rewite then mail for p...@domain or p...@domain  
will get

sent on to the MTA with an envelope recipient address of catch...@domain
rather than their original recipient address.

I've tried various work arounds without success. The one that seems most
natural, but which DOES NOT WORK, is the following:

virtual_aliases:
p...@domain @domain p...@domain
p...@domain @domain p...@domain

This results in mail for either address only arriving in their own  
mailbox.


Is there another approach to this that I'm missing?



Re: Same address delivering to multiple mailboxes

2009-11-23 Thread Sean Holdsworth

On 21 Nov 2009, at 10:58, mouss wrote:

> Sean Holdsworth a écrit :
>> [snip]
>> 
>> If I allow that address rewite then mail for p...@domain or p...@domain will
>> get
>> sent on to the MTA with an envelope recipient address of catch...@domain
>> rather than their original recipient address.
>> 
>> I've tried various work arounds without success. The one that seems most
>> natural, but which DOES NOT WORK, is the following:
>> 
>> virtual_aliases:
>> p...@domain @domain p...@domain
>> p...@domain @domain p...@domain
>> 
>> This results in mail for either address only arriving in their own mailbox.
>> 
>> Is there another approach to this that I'm missing?
>> 
> 
> you want smtp_generic_maps.

Sorry but having reread the address rewrite documentation several times, I 
don't understand how smtp_generic maps would help in this case. To restate the 
problem, I'm trying to figure out a way of doing the following deliveries:

@domain => smtp:[MTA]
p...@domain => B, smtp:[MTA]
p...@domain => C, smtp:[MTA]

(where domain is a virtual domain, B and C are virtual mailboxes and MTA is 
another Postfix server. I have the following configuration in place:

virtual_alias_maps = hash:virtual_aliases
virtual_mailbox_maps = hash:virtual_mailbox_recipients
transport_maps = hash:transport

virtual_aliases:
p...@domain p...@domain catch...@domain
p...@domain p...@domain catch...@domain

virtual_mailbox_recipients:
@domain OK
p...@domain B
p...@domain C

transport:
domain smtp:[MTA]
p...@domain virtual
p...@domain virtual

I think I understand the purpose of smtp_generic_maps to do rewrite of both 
envelope and header addresses for smtp deliveries, but I can't see how that 
would help in this case. What would I have as my LHS in such a mapping? If I 
add the following configuration:

smtp_generic_maps = hash:generic_aliases

what would my generic_aliases file look like? If I have catch...@domain as my 
LHS then I've lost the information about which of p...@domain or p...@domain 
that I need to rewrite to, or am I missing the point?

Alternatively I've played around with using the @domain format in the 
virtual_aliases and using that as the RHS of the generic_aliases file, but that 
results in just a single virtual mailbox delivery and nothing being sent over 
the smtp transport.

For completeness, here's the output of postconf -n

address_verify_map = btree:/var/mta/verify
address_verify_sender = postmas...@mydomain.net
address_verify_transport_maps = hash:/etc/postfix/verify_transport
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
default_process_limit = 500
disable_vrfy_command = yes
header_checks = regexp:/etc/postfix/header_checks
html_directory = /usr/share/doc/postfix/html
inet_interfaces = all
maps_rbl_reject_code = 554
message_size_limit = 4096
myhostname = mx.mydomain.net
mynetworks = 127.0.0.0/8 10.0.1.0/24
readme_directory = /usr/share/doc/postfix
relay_domains = /etc/postfix/relay_domains
relayhost = 
smtp_generic_maps = hash:/etc/postfix/generic_maps
smtpd_banner = $myhostname ESMTP
smtpd_client_connection_rate_limit = 60
smtpd_client_message_rate_limit = 60
smtpd_client_recipient_rate_limit = 60
smtpd_client_restrictions = permit_mynetworkscheck_recipient_access 
hash:/etc/postfix/nofilter_domains  reject_rbl_client bl.spamcop.net
reject_rbl_client sbl-xbl.spamhaus.org  check_client_access 
hash:/etc/postfix/known_clients check_client_access 
hash:/etc/postfix/blacklist check_client_access hash:/etc/postfix/whitelist 
reject_unknown_reverse_client_hostname  check_client_access 
cidr:/etc/postfix/spam_ranges   check_client_access 
regexp:/etc/postfix/spam_domains
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_delay_reject = yes
smtpd_discard_ehlo_keywords = silent-discard, dsn
smtpd_error_sleep_time = 10s
smtpd_helo_required = yes
smtpd_helo_restrictions = check_recipient_access 
hash:/etc/postfix/nofilter_domains reject_invalid_hostname 
check_helo_access regexp:/etc/postfix/helo_restrictions reject_non_fqdn_hostname
smtpd_recipient_restrictions = reject_non_fqdn_recipient
reject_invalid_hostname reject_unauth_destination   check_recipient_access 
hash:/etc/postfix/recipient_restrictions check_recipient_access 
hash:/etc/postfix/recipient_access   check_recipient_access 
hash:/etc/postfix/fallback_domain_access check_recipient_access 
hash:/etc/postfix/nofilter_domains   check_recipient_access 
hash:/etc/postfix/spammed_addresses  check_policy_service 
inet:192.168.25.1:6
smtpd_restriction_classes = check_if_from_hsbc.co.ukcheck_if_from_hsbc.com 
check_if_from_halifaxcheck_if_from_lloydstsb.co.uk   
check_if_from_lloydstsb.com check_if_from_barclays.co.uk
check_if_from_abbey check_if_from_citibank.co.ukc

Re: Same address delivering to multiple mailboxes

2009-11-24 Thread Sean Holdsworth

On 24 Nov 2009, at 00:03, mouss wrote:

> Sean Holdsworth a écrit :
>> On 21 Nov 2009, at 10:58, mouss wrote:
>> 
>>> Sean Holdsworth a écrit :
>>>> [snip]
>>>> 
>>>> If I allow that address rewite then mail for p...@domain or p...@domain 
>>>> will
>>>> get
>>>> sent on to the MTA with an envelope recipient address of catch...@domain
>>>> rather than their original recipient address.
>>>> 
>>>> I've tried various work arounds without success. The one that seems most
>>>> natural, but which DOES NOT WORK, is the following:
>>>> 
>>>> virtual_aliases:
>>>> p...@domain @domain p...@domain
>>>> p...@domain @domain p...@domain
>>>> 
>>>> This results in mail for either address only arriving in their own mailbox.
>>>> 
>>>> Is there another approach to this that I'm missing?
>>>> 
>>> you want smtp_generic_maps.
>> 
>> Sorry but having reread the address rewrite documentation several times, I 
>> don't understand how smtp_generic maps would help in this case. To restate 
>> the problem, I'm trying to figure out a way of doing the following 
>> deliveries:
>> 
> 
> 
> use virtual aliases like this:
> 
> j...@example.com f...@example.net, bar+...@example.com
> 
> 
> where "bar+joe" keeps the "joe" information.
> 
> at the time of delivery, rewrite
> bar+...@example.com j...@example.com
> 
> 
> if this doesn't do what you want, please explain your problem without
> citing any postfix methods/solutions/parameters. in short, explain your
> problem in "the problem domain", not in the solution domain.
> 

Thanks for the additional suggestion but I'm still not able to do what I'm 
attempting without an address rewrite causing problems, so I'll do as you 
suggest and try and explain the problem without trying to solve it.

I have two mail servers. The first mail server acts as MX for a domain. That 
domain has a catchall delivery rule and a few specific addresses. Mail that 
doesn't match a specific address is  forwarded on to the second mail server 
(via SMTP). Mail to any of the specific addresses is delivered into a local, 
per address mailbox on the first mail server, but a copy is also sent on to the 
second  mail server so that this second mail server receives a copy of any mail 
sent to an address in the domain. The second mail server must see mail being 
delivered to the same address to which it was sent on the first mail server. Is 
this possible without a custom delivery agent, which is how I'm currently 
solving this problem?