Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------------------
- -- Create these folders in your mail browser -------
- ----------------------------------------------------
- --
- -- yeah, yeah I know they are stupid names
- -- FileterEmail
- -- SalesCrap
- -- --and any other folder you might need/want
- --
- ----------------------------------------------------
- -- Here is where you will install imapfilter -------
- ----------------------------------------------------
- --
- -- sudo apt-get install imapfilter
- --
- ----------------------------------------------------
- -- You will need to make your config folder --------
- ----------------------------------------------------
- --
- -- mkdir -p ~/.imapfilter
- -- cd ~/.imapfilter
- --
- ----------------------------------------------------
- -- Create the config.lua file ----------------------
- ----------------------------------------------------
- --
- -- touch config.lua
- -- nano config.lua
- --
- ----------------------------------------------------
- -- Read documentation and examples on Github -------
- ----------------------------------------------------
- --
- -- https://github.com/lefcha/imapfilter/blob/master/samples/config.lua
- --
- ----------------------------------------------------
- -- Edit the cron job so it runs automatically ------
- ----------------------------------------------------
- -- edit crontab:
- -- crontab -e
- -- add line:
- -- */15 * * * * imapfilter
- -- or
- -- 0,15,30,45 * * * * imapfilter
- ----------------------------------------------------
- ----------------------------------------------------
- -- Options -----------------------------------------
- ----------------------------------------------------
- options.timeout = 45
- options.subscribe = true
- options.starttls = true
- ----------------------------------------------------
- -- Accounts Setup ----------------------------------
- ----------------------------------------------------
- Email = IMAP {
- server = '[YOUR_SERVER]', -- ex. imap.googlemail.com
- username = '[YOUR_USERNAME]',
- password = '[YOUR_PASSWORD]',
- ssl = 'tls1'
- }
- ----------------------------------------------------
- -- Filters -----------------------------------------
- ----------------------------------------------------
- -- I move my unseen email to a temp folder before
- -- I filter it, then move it back. This works for
- -- me because otherwise I noticed it was scanning
- -- all of my email every time. That could have been
- -- user error though
- -- Move new mail to 'FileterEmail'
- new_messages = Email.INBOX:is_unseen()
- new_messages:move_messages(Email['FileterEmail'])
- -- Buy Me Now!!!
- messages = Email['FileterEmail']:contain_subject('Sales just for you! do not miss them!') +
- Email['FileterEmail']:contain_subject('[100tb.com] Invoice Notice')
- Email['FileterEmail']:mark_seen(messages)
- messages:move_messages(Email['SalesCrap'])
- -- Place all email back in INBOX
- remaining = Email['FileterEmail']:select_all()
- remaining:move_messages(Email.INBOX)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement