Duplicate messages with always_bcc
\ Ben (16 Jan 2008)
. \ Ben (16 Jan 2008)

14 msg[OT] Saving outgoing email Gmail style
3 msg451 error
10 msgPostfix 2.5 release candidate (and 2.6 snapshot...
2 msgpostfix errors when sending smtp auth via yahoo
4 msgDocumentation enhancement: Adjusting DB file pe...
11 msgI don't want Postfix to confirm users via telnet
3 msgQuestion on Earthlink and dnsbl.sorbs.net
36 msgRe: Enforced Outbound TLS (part deux)
6 msgsmtpd_proxy_filter to unix: problem
4 msgAgain troubles with postfix and cyrus-sasl
3 msgExclude local host from smtpd_proxy_filter
4 msgtransport nexthop nexthop
3 msgTLS has been selected, but TLS support is not c...
2 msgWhich documentation to read for this..
4 msgExchange 2003 to Postfix maildir migration
7 msgvirtual_mailbox_base & LDAP
12 msgEnforced Outbound TLS
2 msgpostfix+maildrop error
10 msgOutgoing IP address
Subject:Duplicate messages with always_bcc
Group:Postfix-users
From:Ben
Date:16 Jan 2008


 
Hi, we use Postfix as an SMTP gateway. It does range of things such as
sending mail on to other servers, adding disclaimers to the footer of
certain emails, passing certain emails through to procmail to handle,
SPAM filter, virus filter, etc.

Every email that comes through also gets sent to a general email address
via always_bcc. This basically gets passed to a script which inserts the
mail into a CRM database if the mail was sent to or from one of our
customers. So, always_bcc sends to crmimport. If postfix
passes an email that contains that address, it then passes it to
procmail which then in turn passes it to a script to handle.

I have a procmail rule that basically reads, anything coming to
accounts, then pass it off to another script to handle.
This works, but the problem is that when an email is sent to
accounts, always_bcc comes into play and sends via bcc to
crm. The procmail rule that handles accounts
picks this up again which causes duplicate emails. I just have no idea
how I can get around this. I will post my relevant parts of some files:

main.cf:

smtp inet n - n - - smtpd
-o always_bcc=crmimport
-o cleanup_service_name=disclaimer-cleanup
procmail unix - n n - 10 pipe
flags=hu user=mail argv=/usr/bin/procmail
dspam unix - n n - 10 lmtp
disclaimer-cleanup unix n - n - 0 cleanup
-o always_bcc=crmimport
-o header_checks=pcre:$config_directory/headers_disclaimer

/etc/postfix/transport:
/^expenses$/ procmail:expenses
/^crmimport$/ procmail:crmimport

/etc/procmailrc:
:0w
* ^To:.*expenses
* !.*crmimport
* ^Subject:[ \t]*\/[^ ].*
| /usr/local/sbin/somescript.sh

# Catch all rule for crmimport to pickup all remaining messages
[ .. ]

So basically, any rule that gets sent off to procmail and gets caught in
a procmail rule will get generated twice. Seeing that always_bcc doesn't
change the To: header, it's always going to catch the same procmail rule.

Any help appreciated. Thanks.

Ben.



© 2004-2008 readlist.com