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]';
keep;

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

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

  • August 28, 2009 at 11:19 pm
    Permalink

    I add in textbox of Custom Rules of [email protected]

    cc “[email protected]” and dont work.

    The email1 receice the email but email2 not. What is wrong

    Reply
  • August 29, 2009 at 12:06 pm
    Permalink

    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.

    Reply
  • September 6, 2009 at 11:11 pm
    Permalink

    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.

    Reply
  • September 15, 2009 at 8:02 pm
    Permalink

    Works for me if the domain is the same or if its a different domain.

    Reply
  • September 17, 2009 at 12:52 am
    Permalink

    Using ISP config 3.0.1.4 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.

    Reply
  • September 25, 2009 at 10:22 pm
    Permalink

    One problem, just installed ISPConfig 3 and there´s NO “Custom Rules” filed anywhere in the e-mail part. Anyone can help?

    Reply
  • September 30, 2009 at 9:12 am
    Permalink

    @Alex. The custom rules field is on the “Custom Rules” tab of the mailbox form.

    Reply
  • September 30, 2009 at 8:06 pm
    Permalink

    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?

    thx

    Reply
  • October 2, 2009 at 10:31 am
    Permalink

    Is there any way to debug this? log it?

    Reply
  • October 2, 2009 at 8:27 pm
    Permalink

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

    Thanks 4 everyone, ispconfig seems a great tool

    Reply
  • October 12, 2009 at 5:04 pm
    Permalink

    ufff, i make this:) working on 3.0.14 and 3.0.15
    manual make file in
    var/vmail/mailfilters/domain.com/user

    file *.mailfilter with
    cc “! [email protected]

    Reply
  • October 12, 2009 at 11:27 pm
    Permalink

    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.

    Reply
    • October 21, 2009 at 10:57 pm
      Permalink

      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 3.0.1.6

      Reply
  • October 23, 2009 at 10:39 am
    Permalink

    v3.0.1.6
    None of the methods above work.
    Quite frustrating.

    Sam

    Reply
    • October 23, 2009 at 1:46 pm
      Permalink

      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.

      Reply
  • October 26, 2009 at 8:21 am
    Permalink

    Got it to work.
    The copy/paste from this web page created wrong ”quotes” and thus it failed to work.

    Sam

    Reply
  • November 2, 2009 at 10:37 am
    Permalink

    Hello!

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

    Reply
  • November 28, 2009 at 9:13 am
    Permalink

    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]

    ?
    Peter

    Reply
    • February 18, 2010 at 1:03 am
      Permalink

      cc [email protected]
      cc [email protected]

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

      Reply
  • December 15, 2009 at 4:34 pm
    Permalink

    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?

    Reply
  • May 28, 2010 at 11:25 pm
    Permalink

    I encountered this exact same issue running a clean install of ISPConfig 3.0.1.6 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 3.0.1.6, 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.

    Reply
  • June 25, 2010 at 8:23 pm
    Permalink

    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 🙂
    Steffen

    Reply
  • July 16, 2010 at 11:32 am
    Permalink

    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
    stop;
    }

    #################################################################
    # 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
    stop;
    }
    vacation :days 1
    :subject “Out of office reply”
    # :addresses [“[email protected]”, “[email protected]”]
    “”;

    Plz Help..

    Reply
    • July 16, 2010 at 11:34 am
      Permalink

      The custom rule that is described here is for courier pop3/imap server and not for sieve.

      Reply
      • July 16, 2010 at 12:18 pm
        Permalink

        I’m using the perfect server centos5 64bit configuration using Dovecot

        Reply
        • July 16, 2010 at 12:20 pm
          Permalink

          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]”;
          keep;

          Reply
          • July 16, 2010 at 12:33 pm
            Permalink

            Thanks a lot …..its start working now…

  • November 8, 2011 at 9:35 am
    Permalink

    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!

    Maik

    Reply
  • July 31, 2012 at 7:33 pm
    Permalink

    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]”;
    keep;

    Reply
  • September 6, 2012 at 1:28 pm
    Permalink

    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]’;
    stop;

    Reply
  • September 28, 2012 at 6:24 pm
    Permalink

    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..

    Reply
  • November 6, 2012 at 8:14 pm
    Permalink

    Hi jumbo,
    try with this script in custom rules:

    redirect [email protected];
    discard;
    stop;

    Reply
  • September 8, 2013 at 11:57 am
    Permalink

    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]”;
    keep;

    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.

    Reply
  • September 13, 2014 at 10:02 am
    Permalink

    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.
    Bogdan

    Reply

Leave a Reply

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