# Postfix duplicates messages

## booboo-001

Hi.

I have set up mail system according to Virtual Mailhosting System with Postfix Guide. The system works correctly, but if i create an virtual alias, which pattern is the same as virtual account and resolves to that virtual account and other recipient, than postfix duplicates messages for second recipient.

The virtual alias is set like this:

```

mysql> select * from users where email like "%user1%";

+----+---------------+

| id | email         |

+----+---------------+

| 10 | user1@domain1 |

+----+---------------+

mysql> select * from virtual where email like "%user1%";

+-----+---------------+------------------------------+

| id  | email         | destination                  |

+-----+---------------+------------------------------+

| 100 | user1@domain1 | user1@domain1, user2@domain2 |

+-----+---------------+------------------------------+

```

Now, message sent to user1@domain1 is delivered once to user1@domain1 and twice to user2@domain2.

In other words, how can I set up an alias for recipient user1@domain1 to deliver message to him and to user2@domain2?

Booboo

----------

## booboo-001

Any idea?

----------

## kashani

This syntax normally works in regular alias files, but might not coming from a db so caution and testing are in order. 

```

\user1@domain1, user2@domain2

```

kashani

----------

## booboo-001

Hi.

Still got duplicate messages for user2@domain2.

Booboo

----------

## beezle

Hey,

i got the same problem in the same situation, can't figure out whats going wrong  :Sad: 

the mail.log:

[postfix/smtp] 2FCF2D3CA30: to=<teichrib@xxxnet.de>, relay=mail.xxxnet.de[85.10.206.23]:25, delay=2.7, delays=0.14/0.01/2.5/0.04, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 1D6C710540C6)

[postfix/smtp] E5721D3CA2F: to=<teichrib@xxxnet.de>, orig_to=<teichrib@noxxx.de>, relay=mail.xxxnet.de[85.10.206.23]:25, delay=3.7, delays=0.14/0.04/3.5/0.03, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as D7CF610540C6)

greets

andreas

----------

## kashani

The problem is that from Postfix's perspective nothing is wrong. See this link for an explanation.

http://www.postfix.org/faq.html#duplicate

In Postfix 2.1 and later enable_original_recipient = yes is on by default. I can't tell exactly, but trying to turn it off might give you the behavior you want. It might also break other things so test thoroughly. 

kashani

----------

## booboo-001

 *kashani wrote:*   

> The problem is that from Postfix's perspective nothing is wrong. See this link for an explanation.
> 
> http://www.postfix.org/faq.html#duplicate
> 
> 

 

According to this document I wouldn't be surprised, when duplicates messages would be sent to user1@domain1. But why this happens to user2@domain2?

Booboo

----------

## eusanpe

I had the same problem. I currently use postfix and spambouncer along with procmail so I have the following as the first recipe

in .procmailrc

# Delete Duplicate Messages

:0 Whc: msgid.lock

| formail -D 8192 msgid.cache

  :0 a:

  /dev/null

In postfix main.cf I have:

mailbox_command = /usr/bin/procmail

This eliminated the duplicate messages.

Good luck.

Tony

----------

