procmail
[Top] [All Lists]

BCC and duplicate local messages

2004-12-02 02:03:30
Hello,

we have got a small (?) problem with our postfix/procmail configuration.

(1) Problem description

When we send a local message containing several local receivers, all
receivers get the mail multiple times.

example:
I send one mail to 5 colleagues, all 5 colleagues will receive the same mail
5 times = 25 mails total.

It seems, that postfix passes the mail for each receiver to procmail=> 5
mails. Procmail interpretes the header of each mail and sends the mail to
all receivers found=> 25 mails total.

I inserted this recipe:
########
:0 Wh: msgid.log

| formail -D 8192 msgid.cache

#####

This prevends the multiple mails. BUT now I have got another problem. If a
mail is send (from local or from extern) containing BCC-receivers, postfix
sends the mail to procmail for every receiver. But only the first
bcc-receiver gets the mail, all other mail-receivers get nothing, because
procmail thinks, that these emails are duplicates.

(2)  What the system should do

The mail process should not create multiple messages, if several local
receivers are entered in the mail header.

The mail process should deliver BCC mails in the correct way.  If there are
several local receivers, they should all get the message.


(3) configuration
Mail processing is done this way:

3a
fetchmail -> postfix -> procmail -> cyrus

3b
All Mails, that are send to our domain are first stored in a provider
mailbox and are collected with fetchmail. Fetchmail passes the mails through
to the container "maildummy".
3c
Postfix takes the mails an passes them to procmail. the receiver-parameter
is set for all external mails to "maildummy".
3d
Now, procmail processes through the procmailrc file and tries to deliver the
mail to the mailboxes. If procmail finds the correct receiver(s), it passes
the mail to cyrus and marks the mail. Here is the procmail config file:

##### procmailrc ###########################
VERBOSE=on

MAILDIR=/var/spool/mail/

LOGFILE=/var/log/procmaillog

PATH=/bin/:/usr/bin/:/usr/local/bin/:~bin/:/usr/local/anomy/bin/

ANOMY=/usr/local/anomy

DELIVERMAIL=/usr/lib/cyrus/bin/deliver

MESSAGEID=`/usr/bin/formail -xMessage-ID:`

FROM=`/usr/bin/formail -xFrom:`

FHEADER = `/usr/bin/formail -zX ""`

FORMAIL = /usr/bin/formail

:0f

| sed 1d

:0fw

| /usr/bin/formail -f -A"X-RECEIVER: $2"

## Suppress duplicates

:0 Wh: msgid.log

| formail -D 8192 msgid.cache

#### Spam Assassin ###

:0fw

| spamassassin

#### Delete Header-Field ###

:0fw

| /usr/bin/formail -f -I"X-Delivered:"

# Mark mail

:0fw

| /usr/bin/formail -f -A"X-Procmail: used"

#======== Mailinglists
=================================================================

:0

* $ ^(To):(_dot_)*procmail(_at_)lists(_dot_)rwth-aachen(_dot_)de

| $DELIVERMAIL -e -a jens -m user.jens.procmail

#===========================================================================
==========================

USER=jens

EMAIL=(jreinartz|jr|jens\.reinartz|jens)@snackpointplus.de

:0

* $ ^(Envelope-to|To|Cc|Bcc|X-RECEIVER):.*$EMAIL

{

:0c

* ^X-Spam-Status: Yes

| $DELIVERMAIL -e -a $USER -m user.$USER.Spam

:0c

* ! ^X-Spam-Status: Yes

| $DELIVERMAIL -e -a $USER -m user.$USER

:0fw

| /usr/bin/formail -f -A"X-Delivered: $USER"

}

#===========================================================================
==========================

USER=avoell

EMAIL=(avoell)

:0

* $ 
^(Envelope-to|To|Cc|Bcc|X-RECEIVER):(_dot_)*$EMAIL(_at_)snackpointplus(_dot_)de

{

:0c

* ^X-Spam-Status: Yes

| $DELIVERMAIL -e -a $USER -m user.$USER.Spam

:0c

* ! ^X-Spam-Status: Yes

| $DELIVERMAIL -e -a $USER -m user.$USER

:0fw

| /usr/bin/formail -f -A"X-Delivered: $USER"

}



# [ ... more users ... ]

#====Delete mails, that are delivered to mailboxes
================================================================

:0

* ^X-Delivered

/dev/null

#====Send mails to maildummy (Mail-Admin) -Mailbox, if mail was not
delivered ===========================================

:0

| $DELIVERMAIL maildummy


##### /procmailrc ###########################

I hope someone has an idea to solve this problem. I am wondering, why this
problem seems not to appear at other companies (because our mailserver ist
configured totally wrong?).

Jens


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>