Link to home
Start Free TrialLog in
Avatar of krishneuron
krishneuron

asked on

How to bypass sender_bcc_maps & recipient_bcc_maps for specific users within the same domain

Hi,

I have a postfix setup for a client domain "domain.com" wherein I have configured sender_bcc and recipient_bcc maps in this manner:

sender_bcc

a@domain.com  d@domain.com
b@domain.com  d@domain.com
c@domain.com  d@domain.com

where a,b and c are regular users and d is their team leader. However the problem I have is that when d sends mail to either a, b or c, based on the sender_bcc and recipient_bcc rules, d gets a copy of the mail as well -- which is not required.

What I would like to know is that how do I restrict sender/recipient_bcc for a specific user -- i.e. is it possible for me to set a rule where mails between users on the same domain will not be affected by the sender/recipient_bcc rule.

Appreciate your inputs/ideas to implement this.

Best Regards,
Krish
ASKER CERTIFIED SOLUTION
Avatar of DVB
DVB

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DVB
DVB

Could you post the solution you used please?
Avatar of krishneuron

ASKER

I was looking at your point of using content filters and since I was already using amavisd-new to filter mail for Virii and Spam, I hit upon another idea.

Therefore I changed the local delivery method to procmail and wrote a procmail recepie to do the filtering for me.

The procmail recipie I used was this ...

:0
* ^From.*<recipient@domain.com>
/dev/null

:0 Wh: msgid.lock
| formail -D 8192 msgid.cache

# Store Information about the latest message
# c then continue
:0Wc
| echo "${DFROM2_}" > LastIn ;\
  echo "${DSUBJ_}" >> LastIn ;\
  echo "${DWC_}" >> LastIn

# Store Variables
FROM2_=`formail -c -I"Reply-To:" -rt -xTo: \
 | tr '\;\|\$\`\\]/' '     ' \
 | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
DFROM2_=`echo /${FROM2_}/ \
 | expand | sed -e 's/[ \<\>\+\?\$] //g'`
SUBJ_=`formail -z -c -xSubject: \
 | expand | tr '\;\|\$\ `\\] /' '    ' \
 | sed -e 's/ */ /g' \
 | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
DSUBJ_=`echo /${SUBJ_}/ | expand | sed -e 's/[ \<\>\+\?\$] //g'`
DWC_=/`wc -w`/

# Discard doubles
# W wait for the filter or program to finish
# supress any 'Program Failure' message
:0W
* $ ? sed -n 1p LastIn | egrep -is '${DFROM2_}'
* $ ? sed -n 2p LastIn | egrep -is '${DSUBJ_}'
* $ ? sed -n 3p LastIn | egrep -is '${DWC_}'
{
  :0
  { RULE="Discard doubles" }
  :0
  /dev/null
}

The idea for the recepie I got after some serious googling ... so credit to these recepies go to the original creators. They are not my own.

Trust this was of use to you. Thanks for putting my thoughts in this direction.

Cheers,
Krish