2 # Copyright (C) 2008-2013, Eric Wong <e@80x24.org>
3 # License: GPLv3 or later <http://www.gnu.org/licenses/gpl-3.0.txt>
4 # Usage: report-spam /path/to/message/in/maildir
5 # my incrontab(5) looks like this:
6 # /path/to/.maildir/cur IN_MOVED_TO /path/to/report-spam $@/$#
7 # /path/to/.maildir/.INBOX.good/cur IN_MOVED_TO /path/to/report-spam $@/$#
8 # /path/to/.maildir/.INBOX.spam/cur IN_MOVED_TO /path/to/report-spam $@/$#
10 # gigantic emails tend not to be spam (but they suck anyways...)
11 bytes=$(stat -c %s $1)
12 if test $bytes -gt 512000
17 # only tested with the /usr/sbin/sendmail which ships with postfix
19 *[/.]spam/cur/*) # non-new messages in spam get trained
20 exec /usr/sbin/sendmail -oem -oi $USER+trainspam < $1
22 *:2,*S*) # otherwise, seen messages only
24 *:2,*T*) exit 0 ;; # ignore trashed messages
26 exec /usr/sbin/sendmail -oem -oi $USER+trainham < $1