mail: Read mails to roll up from external file

Changed rollup filter to read the files to be rolled up from 'rollup.txt'
file in the imapfilter configuration directory. (by default in XDG
basedir-compliant directory such as '~/.config/imapfilter/rollup.txt')

The file consists of sender addresses with a single address on each
line.
This commit is contained in:
Marty Oehme 2020-09-18 17:10:19 +02:00
parent 698e8a63ee
commit bf80c9ecf3
Signed by: Marty
GPG key ID: B7538B8F50A1C800

View file

@ -1,35 +1,27 @@
function sendToFolder(folderFrom, folderTo, senders)
for _, sender in pairs(senders) do
messages = folderFrom:contain_from(sender)
messages:mark_seen()
messages:move_messages(folderTo)
end
end
for _, acc in pairs(accounts) do
sendToFolder ( acc["Inbox"], acc["Dump"],
{
"news@todoist.com",
"server@email.woommart.com",
"noreply@medium.com",
"rollup@unroll.me",
"team@readdlenews.com",
"info@netdata.cloud",
"taco@trello.com",
"quincy@freecodecamp.org",
"support@instapaper.com",
"update@author.email.elsevier.com",
"newsletter@cloudflare.com",
"noreply@notify.docker.com",
"hello@skillshare.com",
"noreply@hostelworld.com",
"waitlist@isthereanydeal.com",
"info@mynameisgriz.com",
"news@postman.com",
"no-reply@tumblr.com",
"contact@mailer.humblebundle.com",
"info@audible.de"
})
function getSenderList(file)
local rollupSenders={}
local file = io.open(file)
if file then
for line in file:lines() do
table.insert(rollupSenders, line)
end
else
print("ERROR: rollup did not find rollup.txt file containing mail addresses.")
end
return rollupSenders
end
sendToFolder (
accounts.gmail["Inbox"],
accounts.gmail["Dump"],
getSenderList(getConfigDir() .. "/rollup.txt")
)