Mailbox - custom filter - send copy if..

Discussion in 'General' started by Kroks, Jun 23, 2022.

  1. Kroks

    Kroks New Member

    Hello,
    using ISPConfig 3.2.8p1. Is there any way to creae filter like this?
    If incoming message (mail) containts word ABC in subject, then send copy of this email to [email protected]
    How can I do that please?
    Very thank you.
     
  2. Kroks

    Kroks New Member

    tried this now but still doesn't work fine:

    if subject :is "ABC"
    {
    redirect "[email protected]";
    }
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Try:

    Code:
    if header :regex    "subject" ["^ABC$"] {
        redirect "[email protected]";
        stop;
    }
    but subject must be really just ABC and nothing else like other text or even whitespace, often it is better using something like:

    Code:
    if header :regex    "subject" ["^.*ABC"] {
        redirect "[email protected]";
        stop;
    }
    which means subject just has to contain ABC.
     
  4. Kroks

    Kroks New Member

    Code:
    if header :regex    "subject" ["^.*ABC"] {
        redirect "[email protected]";
        stop;
    }
    @till thank you, tried it but have some problems:
    subject is "ABC", no copy sent to my email
    subject is "test ABC", no copy sent to my email
    subject is "ABC test", copy is sent to my email but don't see message in original mail account (tried to replace redirect for cc too)
     
    Last edited: Jun 24, 2022
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    This happens due to the stop line. If you like to get the message in the original account too, then remove the stop line.
     
  6. Kroks

    Kroks New Member

    @till thank you. What about 3 tests I sent above?
     
  7. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    To test regular expressions find test tools using Internet Search Engines with
    Code:
    regular expression tester
    Then you can test when the expression matches and when not.
     
  8. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    You can also look at sieve documentation (eg. rfc 5228) for more info, eg. I believe there is a ':contains' match type that does exactly what you want without needing to form a regular expression from it.
     

Share This Page