Created
August 20, 2012 18:38
-
-
Save shuairan/3406526 to your computer and use it in GitHub Desktop.
[Uberspace] Maildrop mailfilter: Sort subaddress-mails into already existing subdirs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAILDIR = "$HOME/Maildir" | |
DEFAULT = "$MAILDIR" | |
# EMails an Erweiterungen in Unterordner verschieben falls dieser existiert | |
if (/^To: .*mail-(.*)@example.com/:h) | |
{ | |
SUBMAILDIR = `find $MAILDIR -iname ".$MATCH1" | head -n 1` | |
`test -d $EMAILDIR/new && exit 1 || exit 0` | |
if ( $RETURNCODE == 1 ) | |
{ | |
to "$SUBMAILDIR"; | |
} | |
} | |
# Standardregel: | |
to "$DEFAULT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorts subaddress-mails (mails including a dash: [email protected]) into a subdir if a suitable (case insensitive) directory exists.
This mailfilter doesn't create new subdirectorys, which can be configured via IMAP Client and/or Roundcube (because I don't want to sort ALL my different subaddresses into subdirs)
To use this script change line 5 to match your personal mail address.
If you want all [email protected] to be placed in a subdirectory "Test", simply create that subfolder and your future mail to "[email protected]" will be sorted there. (existing mails have to be moved manually, maildrop only applies to incoming mails)