1

I've postfix on my server, I'm using procmail and customized shell script to process incoming emails for one of user accounts on my local domain/machine. (work@domain.com)

Everything was just working fine when I had only one recipient in email, but as soon as I add another recipient in email list .. I get same message twice ! (ex: sending message to work+123@doamin.com, work+456@domain.com)

There is no special configuration on main.cf, but:

mailbox_command = /usr/bin/procmail -a "EXTENSION"

and .procmailrc is as follow:

TO=`formail -xTo:`
SUBJECT=`formail -xSubject: \
| expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
SENDER=`formail -xFrom: \
| expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
BODY=`formail -I "" \
| expand | sed -e '1,/^$/ d' -e '1,/^$/ d'`
BODY=`formail -I "" `
SENDER=`formail -rtzxTo:`
:0 
| $HOME/bin/work.sh "$TO" "$BODY"

I was thinking to manage this issue in procmailrc , but my knowledge is so low in this case.

masegaloeh
  • 17,978
  • 9
  • 56
  • 104
atari83
  • 141
  • 4

1 Answers1

2

Well, obviously the solution is lock/cache file to filter duplicate Message-IDs :

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

Thanks everyone :)

atari83
  • 141
  • 4
  • That's just a workaround. The real solution is to handle transport in transport. See http://porkmail.org/era/procmail/mini-faq.html#virtdom – tripleee Dec 09 '14 at 08:28