1

I want to put emails that are forwarded to my main mailbox (from another domain) into specific sub-folders. For example: foo@bar goes to INBOX/bar/foo.

require ["fileinto", "envelope", "regex", "mailbox"];

if header :regex "delivered-to" "(.*)@(.*)" {
    if not envelope :is "to" "${1}@${2}" {
        fileinto :create "INBOX/${2}/${1}";
    }
}

The capture groups are not replaced in INBOX/${2}/${1}, why ?

dblouis
  • 568
  • 1
  • 5
  • 18

1 Answers1

3

Match group variables are not part of the regex capability, but the variables capability. Also require ["variables"]; to be able to use them.

Community
  • 1
  • 1
Jens Erat
  • 37,523
  • 16
  • 80
  • 96
  • Is there a way to replace dots with underscore in a variable? – dblouis Aug 22 '17 at 15:46
  • This does not really seem a direct follow-up question to your original question but a new one, please ask an actual new question instead of discussing it in the comments. – Jens Erat Aug 22 '17 at 15:49
  • Ok, I'm gonna have to wait 50 minutes to do that, for whatever reason... – dblouis Aug 22 '17 at 15:57