Created
March 20, 2017 13:27
-
-
Save jpommerening/67a7de664fb0d608b0e22916af9b410a to your computer and use it in GitHub Desktop.
Some procmail patterns
This file contains 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
LOGFILE=$HOME/procmail.log | |
VERBOSE=on | |
MAILDIR=/var/spool/imap/$LOGNAME | |
DEFAULT=./ | |
TOP=. | |
SP=" " | |
SPC="[$SP]" | |
NSPC="[^$SP]" | |
# Subject line start (handling optional =?UTF-8?Q? tags) | |
ST="$SPC*(=([?][^?]+)+[?])?" | |
# Backup | |
# :0 c | |
# $TOP/backup/ | |
## | |
## JIRA | |
## | |
## Match header | |
## | |
## Subject: [JIRA] (PROJ-123) Title | |
## | |
:0HD: | |
*$ ^$SPC*Subject:$ST\[JIRA\][_$SP]+[(]\/[A-Z]+ | |
{ | |
TARGETDIR=$TOP/JIRA/$MATCH | |
:0: | |
* ? test -d "$TARGETDIR" || mkdir "$TARGETDIR" | |
$TARGETDIR/ | |
} | |
# Set status flag on mail | |
:0HDf | |
*$ ^$SPC*Subject:$ST\[JIRA\] | |
|formail -I"X-Status: F" | |
# ... and store in JIRA folder | |
:0a: | |
$TOP/JIRA/ | |
## | |
## Buildbot | |
## | |
:0H: | |
* ^From:.*builds@travis-ci.org | |
{ | |
TARGETDIR=$TOP/Travis | |
:0c | |
*$ ^$SPC*Subject:.*Passed: | |
$TARGETDIR/ | |
:0a | |
* LASTFOLDER ?? ()\/[^/]+^^ | |
|mv "$LASTFOLDER" "$TARGETDIR/cur/$MATCH:2,S" | |
:0: | |
$TARGETDIR/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment