Skip to content

Instantly share code, notes, and snippets.

@AlexandreRio
Created October 10, 2013 22:04
Show Gist options
  • Save AlexandreRio/6926374 to your computer and use it in GitHub Desktop.
Save AlexandreRio/6926374 to your computer and use it in GitHub Desktop.
Bind a key in Mutt to add new rule for imapfilter from email sender
#!/bin/bash
read "$@" <&0;
grep From: |
sed 's/>//g' |
cut -d '<' -f 2 >> ~/.mail_config/filters/spamer.list 2>&1
fh,err = io.open("spammer.list")
if err then print("OOps"); return; end
while true do
line = fh:read()
if line == nil then break end
msgs = EECS.INBOX:contain_from(line)
msgs:move_messages(EECS['INBOX.Trash'])
end
fh:close()
macro index S "|~/.mail_config/filters/addSpam.sh\n" 'add sender to spammer list'
macro pager S "|~/.mail_config/filters/addSpam.sh\n" 'add sender to spammer list'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment