pastes/imapfilter_config.lua

76 lines
1.9 KiB
Lua
Raw Normal View History

2021-08-12 21:59:20 -04:00
---------------
-- Options --
---------------
options.timeout = 120
options.subscribe = true
----------------
-- Accounts --
----------------
-- Connects to "imap1.mail.server", as user "user1" with "secret1" as
-- password.
--account1 = IMAP {
-- server = 'imap1.mail.server',
-- username = 'user1',
-- password = 'secret1',
--}
-- Another account which connects to the mail server using the SSLv3
-- protocol.
mygmail = IMAP {
server = 'imap.gmail.com',
username = 'redacted',
password = 'redacted',
ssl = 'tls12',
}
-- Get a list of the available mailboxes and folders
--mailboxes, folders = account1:list_all()
-- Get a list of the subscribed mailboxes and folders
--mailboxes, folders = account1:list_subscribed()
-- Create a mailbox
--account1:create_mailbox('Friends')
-- Subscribe a mailbox
--account1:subscribe_mailbox('Friends')
-----------------
-- Mailboxes --
-----------------
-- Get the status of a mailbox
mygmail.INBOX:check_status()
print(os.date("%Y-%m-%d %H:%M:%S Logwatch"))
results = mygmail.INBOX:contain_subject('Logwatch for')
results:mark_flagged()
print(os.date("%Y-%m-%d %H:%M:%S Logwatch"))
print(os.date("%Y-%m-%d %H:%M:%S Facebook"))
results = (mygmail.INBOX:contain_from('facebookmail.com'))
results:move_messages(mygmail.archive)
print(os.date("%Y-%m-%d %H:%M:%S Facebook"))
print(os.date("%Y-%m-%d %H:%M:%S Groupon"))
results = (mygmail.INBOX:contain_from('noreply@r.groupon.com'))
results:move_messages(mygmail.archive)
print(os.date("%Y-%m-%d %H:%M:%S Groupon"))
print(os.date("%Y-%m-%d %H:%M:%S Mobile Saenger"))
results = (mygmail.INBOX:contain_subject('Saenger'))
results:move_messages(mygmail.archive)
print(os.date("%Y-%m-%d %H:%M:%S Mobile Saenger"))
print(os.date("%Y-%m-%d %H:%M:%S Etsy"))
results = (mygmail.INBOX:contain_from('Etsy'))
results:move_messages(mygmail.archive)
print(os.date("%Y-%m-%d %H:%M:%S Etsy"))