]> git.madduck.net Git - etc/mailfilter.git/blob - procmail/tickle

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

gracefully handle local message without orig-to
[etc/mailfilter.git] / procmail / tickle
1 :0
2 * ! DEST ?? .
3 * ! TICKLE_DELIVERED ?? .
4 * ORIGINAL_TO ?? ^.+@tickle\.madduck\.net$
5 * ORIGINAL_TO ?? ^\/[^@]+
6 {
7   DAILY_DELIVERY_TIME=04:20
8   JUST_DATE="`$BIN_DATE -d \"$DATE\" +%x`"
9
10   :0
11   * MATCH ?? ^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$
12   { DELAY="@$MATCH" }
13
14   :0 E
15   * MATCH ?? ^[0-9]+h$
16   * MATCH ?? ^\/[^h]+
17   { DELAY="$DATE + $MATCH hours" }
18
19   :0 E
20   * MATCH ?? ^[0-9]+m$
21   * MATCH ?? ^\/[^m]+
22   { DELAY="$JUST_DATE + $MATCH months $DAILY_DELIVERY_TIME" }
23
24   :0 E
25   * MATCH ?? ^[0-9]+w$
26   * MATCH ?? ^\/[^w]+
27   { DELAY="$JUST_DATE + $MATCH weeks $DAILY_DELIVERY_TIME" }
28
29   :0 E
30   * MATCH ?? ^[0-9]+d?$
31   * MATCH ?? ^\/[^d]+
32   { DELAY="$JUST_DATE + $MATCH days $DAILY_DELIVERY_TIME" }
33
34   JUST_DATE
35   DAILY_DELIVERY_TIME
36
37   :0 E
38   {
39     LOG="tickle:      invalid date string: $MATCH$NL"
40     EXITCODE=69
41     HOST
42   }
43
44   :0 fw
45   |$FORMAIL -i "X-Tickle: $DELAY"
46
47   LOG="tickle:      delaying message until $DELAY$NL"
48
49   # unset DISABLE_DELAYS to enable delaying for tickle messages
50   DISABLE_DELAYS
51 }
52
53 # vim:ft=procmail