> Hi list,
> 
> I need to setup recipient_bcc_maps to get the following behaviour:
> - by default, I need every message to be BBC'd to
> default_...@example.com
> - for particular recipients, I need the message to be BCC'd to
> other_...@example.com (and to this address only)
> 
> - I need particular recipients to be stored in mysql, because of
> integration with other apps
> 
> How should I get this?
> My first solution is:
> 
> recipient_bcc_maps = mysql:/etc/postfix/recipient_bcc_maps.cf,
> regexp:/etc/postfix/recipient_bcc_maps.regexp
> 
> /etc/postfix/recipient_bcc_maps.regexp:
>      /^.*$/    default_...@example.com
> 
> The idea is: I look for "special" recipient addresses in mysql first
> and fallback to the regexp in case of non-match only.
> 
> Is this going to work?
> If not, would you please point me to the relevant documentation?
> 
> Thanks,
> Fabio
> 

You may use something like this:

bcc_table:
address | enabled
<empty_string> | 1
spec...@example.com | 1

SELECT case when `enabled` then 'other_...@example.com' else 
'default_...@example.com' end FROM `bcc_table` where `address` in ('%s','') 
order by `address` desc limit 1;

It's not perfect - just pointing into possible mysql solution whithout extra 
lookup table.

You may also consider using WHERE clause with user_part= '%u' and domain='%d'.

Regards
V.Dimitrov

Reply via email to