ISPConfig 3: How to send copys of incoming emails to other mailboxes

A copy of a incoming email can be sent to a second email address by adding a cc command to the "Custom Rules" field of the mailbox in ISPConfig.

ISPConfig supports sieve as well as maildrop filter rules. The rule language depends on the LDA / POP3 / IMAP-Daemon that you use on your server. If you use courier, then the filter language is maildrop. When dovecot is installed, then the filter language is ieve.

Example in maildrop syntax:

To send a copy to the email address [email protected], add the following code at the beginning of the custom rules field.

cc '![email protected]'

Example in sieve syntax:

redirect '[email protected]';


35 thoughts on “ISPConfig 3: How to send copys of incoming emails to other mailboxes”

  1. Please check in the mail log if the email has been sent. Also make sure that you add the line at the beginning of the rules in case that there are any other filters in this field.

  2. work in my server using single quote: cc ‘![email protected]’, and works if you send email to the “same domain” :S, if I set cc ‘![email protected]’ don`t work.

  3. Using ISP config with ubuntu 9.04

    – tried both cc “![email protected]” and cc ‘![email protected]’ = doesn’t work
    – has only that one string in the custom rule field
    – mail log indicates delivery to my domains e-mail but does not forward out to my Gmail
    – sending out from webmail works fine

    I’ll look in the forums and will try to follow up and post in the bug tracker.

  4. Ok, thx, actually i was trying to manage this rules using the client login, changed to admin and folund it, but, i tryed the commando with double and single quotes, on the same domain, still no success.

    I use CentOS 5.3 i386, my maillog output has no errors, says msgs are queued, but cannot see anything but 0 msgs in queue, using mailq or the iface, can anyone help?


  5. So, here´s the solution, updated my installation to version, and it worked like a charm using double quotes.

    Thanks 4 everyone, ispconfig seems a great tool

  6. Entering the command into the Custom Rules field does exactly the same. It creates the .mailfilter file with the content of the Custom rules field. So there is no need to edit any files manually in ISPConfig.

    1. mailfilters owner is root/root in my system and the subdirectory too. I changed it to vmail/vmail so now its forward mess which I like. I driving Debian 5.3 and ISPConfig

    1. These method definatley works. I use it on my own and client servers with all recent ISPConfig 3 versions. Please post what you entered exactly into the custom rules field.

  7. Hello!

    First I had problems with this solution. The copy-email didn’t arrived… There was no .mailfilter in var/vmail/mailfilters/ … After some tests it worked. The error was that I hadn´t switched on the Spamfilter for that domain at first.

  8. Hi!

    Which format should be user for multiple e-mail adresses?

    For each e-mail address a single line

    cc “![email protected]
    cc “![email protected]

    or comma seperation

    cc “![email protected],![email protected]


    1. cc “![email protected]
      cc “![email protected]

      works perfect, but be careful to type directly into ISPConfig yourself and AVOID copy / paste.

  9. I have the same problem. I think the prob is, that quotes (“, ‘) are masked with “\”, so in my case in .mailfilter stands: cc: \”!something\”.

    So setting the rule manually without backslash works for me, but this isn’t a nice handling.

    By the way – “custom rules”-tab doesn’t exist in german translation. And maybe in others too?

  10. I encountered this exact same issue running a clean install of ISPConfig on Debian.

    The only workable solution I found was to manually edit the backslashes out of the /var/vmail/mailfilters/domainname/username/.mailfilter file after creating it thru the ISPConfig control panel. The web interface did indeed create backslashes in that file to escape the quotes, and suspended delivery (syntax errors in the postqueue) for that mailbox as a result.

    Therefore, on a fresh install of, it is necessary to manually edit the .mailfilter file to get a copy of the mail forwarded to a different address in my experience.

    My advice to anyone needing this functionality is to use the web interface to create the mailfilter file (by going to the mailbox, then the Custom Rules tab, then typing in cc:”![email protected]” in there and submitting it), then immediately using SSH or the console to get into the ISPConfig machine and use your favourite text editor to get the backslashes out of the /var/mail/mailfilters/domainname/username/.mailfilter file.

  11. Just set “magic_quotes_gpc = Off” in php.ini to avoid automatic quotes to be added. Save the rule again after restarting apache and it will work.
    You can check if /var/mail/mailfilters/domainname/username/.mailfilter exists. As soon as you see it, it will work :-)

  12. Custom rules doest not work …..after checking in maillog found there is some problem in sieve….

    Output of Sieve log says..

    #vi /var/vmail/domain/user/.sieve.log

    sieve: info: started log at Jul 16 14:40:59.
    main_script: line 6: error: expected end of command ‘;’ or the beginning of a compound block ‘{‘, but found end of file.
    main_script: error: parse failed.

    OUTPUT of Main script

    #vi /usr/local/ispconfig/server/conf/sieve_filter.master

    require [“fileinto”, “regex”, “vacation”];

    # Move spam to spam folder
    if header :contains “X-Spam-Flag” “YES” {
    fileinto “Junk”;
    # Stop here so that we do not reply on spams

    # Autoreply

    # Move spam to spam folder
    if header :contains “X-Spam-Flag” “YES” {
    fileinto “Junk”;
    # Stop here so that we do not reply on spams
    vacation :days 1
    :subject “Out of office reply”
    # :addresses [“[email protected]”, “[email protected]”]

    Plz Help..

        1. And at the time this FAQ article was written (in August 2009), courier was the only supported pop3 and imap daemon. If you use dovecot, then use a sieve rule to redirect your emails. e.g.:

          redirect “[email protected]”;

  13. Hey, thank you for this hack!! It is working like a charm for my ISPConfig 3 installation.
    Just created the .mailfilter file, added the cc “![email protected]” , and it worked without any issue!

    Thanks, again!


  14. It should be noted that the Sieve syntax in the original post is incorrect in that it uses single-quotes (when it must use double-quotes).

    If single-quotes are used instead of double-quotes, the following parse error results:

    main_script: line 5: error: unexpected character(s) starting with ”’.
    main_script: line 5: error: expected end of command ‘;’ or the beginning of a compound block ‘{‘, but found unknown characters.
    main_script: line 5: error: unexpected character(s) starting with ‘@’.
    main_script: line 5: error: unexpected character(s) starting with ‘.’.
    main_script: line 5: error: unexpected character(s) starting with ”’.
    main_script: error: parse failed.

    The correct syntax is as Till stated (be sure to fix any mangled double-quotes if you copy/paste):

    redirect “[email protected]”;

  15. Hi Guys,

    is there any script or settings on how to forward email without leaving a copy of message on the main account?

    tried this in custom rule but it still leaving a copy on my main account. please help.

    redirect ‘[email protected]';

  16. Can anyone help me? need to get any mail sent to my server containing *.xml and sent a copy to a specific email, but only the emails received and sent a copy to specifed email..thanks..

  17. Hi jumbo,
    try with this script in custom rules:

    redirect ‘[email protected]’;

  18. For those like I who use ISPConfig on Ubuntu server (OVH style) here’s how to get multiple redirections working (yes this is for those using dovecot, as pre-setup via OVH)

    Most important IF you want to redirect to MULTIPLE addresses, when configuring e-mail account in ISPConfig, DO NOT put an e-mail address in the ‘Send copy to’ (optional) box, because this automagically puts an extra line up top in the sieve file and fouls the additional info put in the Custom rules tab (in my version of ISPConfig, french language, the tab is ‘Regles personalisés’).

    In the Custom rules (tab on the right), simply input :

    redirect “[email protected]”;
    redirect “[email protected]”;
    redirect “[email protected]”;
    redirect “[email protected]”;

    You can put as many redirects as needed. BTW, double quotes work just fine

    You can checkout your .sieve file (in /var/vmail/domain.tld/user/ ) to see changes : but give ISPConfig 60 seconds to do the changes ( remember that it crons changes once a minute.)

    Hope this helps.

  19. Hello,
    Haw I can make a custom rule for forwarding emails received from specific addresses to other address?
    ISPCONFIG 3 on Ubuntu 12.04
    Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>