Created
June 11, 2013 17:14
-
-
Save adam-stokes/5758764 to your computer and use it in GitHub Desktop.
Using imapfilter to pipe messages through bogofilter
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
all = myserver.INBOX:select_all() | |
spam = Set {} | |
unsure = Set {} | |
for _, mesg in ipairs(all) do | |
mbox, uid = unpack(mesg) | |
text = mbox[uid]:fetch_message() | |
flag = pipe_to('bogofilter', text) | |
if (flag == 0) then | |
table.insert(spam, mesg) | |
elseif (flag == 2) then | |
table.insert(unsure, mesg) | |
end | |
end | |
myserver['INBOX']:move_messages(myserver['Junk'], spam) | |
myserver['INBOX']:copy_messages(myserver['Junk/Unsure'], unsure) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Taken from a forum somewhere, haven't tested nor do I hold any copyrights on this. If someone can find a link to it post it here for reference back to the original author.