mail: Add afew automatic tagging

Added hook for afew tagging for local mail.

Mail will now arrive tagged only as 'new' by notmuch.
afew will then tag the mail accordingly as inbox unread when it is
personal mail.

It will additionally filter out anything marked as spam, or e-mail
containing a List-Id header, which will be tagged as 'list' and not
arrive in the inbox. This filters out anything arriving from a mailing
list from the inbox.

Removed the archive tag -- anything not in the inbox, and not marked as
list is instead used as an automatic archive.

Mail sent by myself will be automatically tagged as 'sent' and also not
show up in the mailbox.
This commit is contained in:
Marty Oehme 2020-09-18 12:25:49 +02:00
parent be688572f5
commit 0d00953f30
Signed by: Marty
GPG key ID: B7538B8F50A1C800
6 changed files with 32 additions and 33 deletions

View file

@ -1,4 +1,5 @@
aerc aerc
afew
alacritty alacritty
an2linuxserver-git an2linuxserver-git
anki anki
@ -33,7 +34,6 @@ glances
glow glow
gnome-keyring gnome-keyring
go go
gopass
grub grub
hugo hugo
i3-gaps i3-gaps
@ -78,6 +78,7 @@ ntp
os-prober os-prober
pacman-contrib pacman-contrib
pandoc-citeproc pandoc-citeproc
pass
pavolume pavolume
pdfjs pdfjs
pia-tools pia-tools

View file

@ -23,17 +23,15 @@ k = :prev<Enter>
gg = :select 0<Enter> gg = :select 0<Enter>
G = :select -1<Enter> G = :select -1<Enter>
J = :next-folder<Enter> c = :cf<space>
<C-n> = :next-folder<Enter> <C-n> = :next-folder<Enter>
K = :prev-folder<Enter>
<C-p> = :prev-folder<Enter> <C-p> = :prev-folder<Enter>
gi = :cf Inbox<Enter> '' = :cf Inbox<Enter>
g' = :cf Important<Enter> 'i = :cf Important<Enter>
' = :cf Important<Enter> 'a = :cf Archive<Enter>
ga = :cf Archive<Enter> 'A = :cf All<Enter>
gA = :cf All<Enter> 's = :cf Sent<Enter>
gs = :cf Sent<Enter> 't = :cf Trash<Enter>
gt = :cf Trash<Enter>
v = :mark -t<Enter> v = :mark -t<Enter>
V = :mark -v<Enter> V = :mark -v<Enter>
@ -41,11 +39,12 @@ V = :mark -v<Enter>
<Enter> = :view<Enter> <Enter> = :view<Enter>
l = :view<Enter> l = :view<Enter>
D = :prompt 'Really delete this message?' 'delete-message'<Enter> D = :prompt 'Really delete this message?' 'delete-message'<Enter>
i = :modify-labels +inbox -archived -deleted<Enter> mi = :modify-labels +inbox -archived -deleted<Enter>
m = :modify-labels +flagged<Enter> mm = :modify-labels +flagged<Enter>
d = :modify-labels +deleted -inbox -archived<Enter> mI = :modify-labels +flagged<Enter>
a = :modify-labels +archived -deleted -inbox<Enter> md = :modify-labels +deleted -inbox<Enter>
A = :modify-labels +archived -deleted -inbox<Enter> mD = :modify-labels -deleted <Enter>
ma = :modify-labels -deleted -inbox<Enter>
C = :compose<Enter> C = :compose<Enter>
@ -54,7 +53,6 @@ rq = :reply -aq<Enter>
Rr = :reply<Enter> Rr = :reply<Enter>
Rq = :reply -q<Enter> Rq = :reply -q<Enter>
c = :cf<space>
$ = :term<space> $ = :term<space>
! = :term<space> ! = :term<space>
| = :pipe<space> | = :pipe<space>

View file

@ -1,9 +1,7 @@
All=* All=*
Inbox=tag:inbox and not tag:archived and not tag:dump Inbox=tag:inbox and not tag:lists
Archive=tag:archived and not tag:inbox and not tag:dump Archive=not tag:inbox and not tag:deleted and not tag:dump
Dump=tag:dump and not tag:inbox Dump=tag:dump and not tag:inbox
Trash=tag:deleted Trash=tag:deleted
Important=tag:flagged Important=tag:flagged
Sent=from:marty.oehme@gmail.com or from:marty.oehme@googlemail.com or from:moehme@ruc.dk or from:mo82rimu@studserv.uni-leipzig.de Sent=from:marty.oehme@gmail.com or from:marty.oehme@googlemail.com or from:moehme@ruc.dk or from:mo82rimu@studserv.uni-leipzig.de
Replied=tag:replied
Patches=subject:/^\[PATCH/

6
mail/.config/afew/config Normal file
View file

@ -0,0 +1,6 @@
[SpamFilter]
[KillThreadsFilter]
[ListMailsFilter]
[ArchiveSentMailsFilter]
sent_tag=sent
[InboxFilter]

View file

@ -1,22 +1,16 @@
function sendtoRollup(acc, senders) function sendToFolder(folderFrom, folderTo, senders)
for _, sender in pairs(senders) do for _, sender in pairs(senders) do
messages = acc["Inbox"]:contain_from(sender) messages = folderFrom:contain_from(sender)
messages:mark_seen() messages:mark_seen()
messages:move_messages(acc["Dump"]) messages:move_messages(folderTo)
-- for _, msg in ipairs(messages) do
-- mailbox, uid = table.unpack(msg)
-- local from = mailbox[uid]:fetch_field("From")
-- local subject = mailbox[uid]:fetch_field("Subject")
-- print(from .. "; " .. subject)
-- end
end end
end end
for _, acc in pairs(accounts) do for _, acc in pairs(accounts) do
sendtoRollup ( acc, { sendToFolder ( acc["Inbox"], acc["Dump"],
{
"news@todoist.com", "news@todoist.com",
"server@email.woommart.com", "server@email.woommart.com",
"noreply@medium.com", "noreply@medium.com",
@ -34,6 +28,8 @@ for _, acc in pairs(accounts) do
"waitlist@isthereanydeal.com", "waitlist@isthereanydeal.com",
"info@mynameisgriz.com", "info@mynameisgriz.com",
"news@postman.com", "news@postman.com",
"no-reply@tumblr.com",
"contact@mailer.humblebundle.com",
"info@audible.de"
}) })
end end

View file

@ -48,7 +48,7 @@ other_email=mo82rimu@studserv.uni-leipzig.de;moehme@ruc.dk;
# in the mail store. # in the mail store.
# #
[new] [new]
tags=unread;inbox; tags=new
ignore= ignore=
# Search configuration # Search configuration