Problem to catchall mails with "Always send a copy (BCC)" on NethServer 7.3

NethServer Version: 7.3
Module: Email

Hi folks,
I have a standard installation of 2 versions: NethServer 6.9 and NethServer 7.3. These servers are used as local mailserver (intranet). Smarthost is used to send/ receive mails to/ from ISP’s mail server…
I have checked the box in Email-> Messages “Always send a copy (BCC)”. This works at NethServer 6.9 but doesn’t work with version 7.3. If I send a mail this will be CCed to mailcc@FQDN (my catchall mailbox/ user) and everything is fine. But if I send a mail to an external echo mailserver (via ISP’s mail server) the reply (echo mail) will be sent only to the senders postbox and not to the mailcc-Postbox.
Maybe this depends on Email alias domains or server alias? Is the character “-” (minus) allowed for domain names? My server name is “”. Additional I have set “” as an alias.
Next I will try to proceed with an update process vom NethServer 6.9 to 7.3…
What can I do else for debug/ diagnostic or does anybody have an idea to check this behaviour?

Best regards,

Uhm, it looks weird. We should replicate this behaviour.

I still don’t have a solution for this. Let me describe some details…
I have a fresh install of NethServer 7.3.:

Now I can send mails from “banane” to “kiwi” and I will get a copy to “mailcc”. So far so good.
Next I want to send mails to an external mailbox via an ISP mailserver. What do I have to do?
I have to configure:

  1. a second Email Domain “” on NethServer according to the public mailbox domain
  2. Smarthost function with correct data for sending mails to the ISP
  3. POP3 connector with external mail account data to get mails from the ISP to NethServer
    Is this right?

Now I send a mail from "" to an echomail Server (
What happens: I get a copy of this mail I’ve send to the "". After a minute or two the echomail comes from the echomail server to "". That’s right but I also expect to receive a copy to "". But I have never seen such a mail… :confused:

Please can anyone give me an advice? Can you replicate this behaviour?
Don’t hesitate to contact me!
Thanks for spending your time and best regards,

From memory: mail downloaded using the POP3 connector doesn’t respect the Bcc settings.
Workaround: a sieve filter.

Oh, many thanks for this advice!
How can I do this? I’ve no experience with this…
With kind regards

…for test purposes I’ve put these lines into "/var/lib/nethserver/sieve-scripts/before-sieve/“
require [“copy”];
if true
redirect: copy "”;

That’s it, great job.
EDIT: if it works, you should “fix” the configuration using a template-custom.

Hi all,
I think I’ve done 1 step to the solution…
The sieve filter now makes a copy to "" but I get 4 duplicate messages from the echo mailserver to mailcc. How can I prevent this?

No idea, sorry. Are the 4 messages the same? Look at the headers, please.

Hi all,
with these settings for sieve filter I’ve got still 2 mail copies to The originating mail was sent from "" to ""- I will get an echo mail from "" to "". This works well.
[“” is a 2nd Email domain name for “”]



NethServer /var/log/maillog

Is there anything else I could do better to prevent duplicate mails?

Hmm, I’ve unchecked Email-> Messages-> Always send a copy (Bcc)… and now I will receive only 1 message as a copy from "" to "" (and of course to ""). This is exactly the behaviour I would like to see. :slight_smile:

Unfortunately in this case I won’t receive a copy of the mail I have sent from “banane” to the echo Server…

Could you add a line containing
after redirect (as in the spam rule above).

Hi Filipo,
I have added the line with
from your advice, but the result is the same, no change at all (2 duplicate mails). :confused:
I am totally confused because I receive additional mails to ‘mailcc’ from sending “banane” -> “echo” after I had used the sieve filter…?
Does sieve filter work for outgoing and incoming mails?

I’ve seen there are some extensions for the sieve package, one of them is called ‘duplicate extension’. Whats about this, can I install/ use this extension? How can I install an extension?

Incoming only.
I have a customization to disable delivery of duplicated email.
It’s a small .tar.gz file I could send to your email address (if you can give it to me in a Private Message).

Hi all,

it is great- now it works!! :smiley::thumbsup:

I am very satisfied with the help of your support, my problem is solved and everything works very well. The duplicate extension for Sieve filters does the job. A big compliment and many thanks for the great support!

I wanted to use the Option “Configuration: Email-> Messages-> Always send a copy (Bcc)…” This already works for outgoing mails (postfix will do this, right?). For incoming mails you have to add a line with 'redirect: copy "<catchall-mailbox>";' into “/var/lib/nethserver/sieve-scripts/before-sieve/”.
And then it is usefull to install/ use the ‘Duplicate extension’ for Sieve filters to avoid duplicate mails.

The only thing I have to do is to create a custom template for sieve…

Finally I am very pleased to found NethServer Project and this community.

Best regards

hello everyone, can i ask the exact syntax of the file? I do not function and I get this error:

Sep 13 13:40:02 mail dovecot: lda ( Error: sieve: before: line 21: expected end of command ‘;’ or the beginning of a compound block ‘{’, but found ':'
Sep 13 13:40:02 mail dovecot: lda ( Error: sieve: before: parse failed
Sep 13 13:40:02 mail dovecot: lda ( Error: failed to compile script /var/lib/nethserver/sieve-scripts/before.sieve

The sys file is configured as follows:

# 10junkmail
# - enabled (move marked SPAM messages into junkmail folder)
require ["fileinto", "mailbox"];
if header: contains "X-Spam-Flag" "YES" {
    file: create "Junk";

redirect: copy "";

Thank you all!

Hi luca, please try this one:

# 10junkmail
# - enabled (move marked SPAM messages into junkmail folder)
require ["fileinto", "mailbox", "copy"];
if header: contains "X-Spam-Flag" "YES" {
    file: create "Junk";
    redirect: copy "";

You should insert the keyword “copy” and some brackets…
Regards Mario

Hi Mario,
now i’ve got this error:

Error: sieve: before: line 21: expected end of command ‘;’ or the beginning of a compound block ‘{’, but found ':'
Sep 13 14:20:02 posta dovecot: lda( Error: sieve: before: parse failed
Sep 13 14:20:02 posta dovecot: lda( Error: sieve: failed to compile script /var/lib/nethserver/sieve-scripts/before.sieve

Line 21 is :
redirect: copy "";

Hi luca,
in my first attempts to edit this sieve script I made the same mistake…
It is important that you type the semicolon without space after but with a space before! :slight_smile:
… “header :contains”
… “file :create”
… “redirect :copy”…
Sure this will help you