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:
parent
698e8a63ee
commit
bf80c9ecf3
1 changed files with 18 additions and 26 deletions
|
@ -1,35 +1,27 @@
|
||||||
function sendToFolder(folderFrom, folderTo, senders)
|
function sendToFolder(folderFrom, folderTo, senders)
|
||||||
|
|
||||||
for _, sender in pairs(senders) do
|
for _, sender in pairs(senders) do
|
||||||
messages = folderFrom:contain_from(sender)
|
messages = folderFrom:contain_from(sender)
|
||||||
messages:mark_seen()
|
messages:mark_seen()
|
||||||
messages:move_messages(folderTo)
|
messages:move_messages(folderTo)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, acc in pairs(accounts) do
|
function getSenderList(file)
|
||||||
sendToFolder ( acc["Inbox"], acc["Dump"],
|
local rollupSenders={}
|
||||||
{
|
|
||||||
"news@todoist.com",
|
local file = io.open(file)
|
||||||
"server@email.woommart.com",
|
if file then
|
||||||
"noreply@medium.com",
|
for line in file:lines() do
|
||||||
"rollup@unroll.me",
|
table.insert(rollupSenders, line)
|
||||||
"team@readdlenews.com",
|
end
|
||||||
"info@netdata.cloud",
|
else
|
||||||
"taco@trello.com",
|
print("ERROR: rollup did not find rollup.txt file containing mail addresses.")
|
||||||
"quincy@freecodecamp.org",
|
end
|
||||||
"support@instapaper.com",
|
return rollupSenders
|
||||||
"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"
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sendToFolder (
|
||||||
|
accounts.gmail["Inbox"],
|
||||||
|
accounts.gmail["Dump"],
|
||||||
|
getSenderList(getConfigDir() .. "/rollup.txt")
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in a new issue