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
afew
alacritty
an2linuxserver-git
anki
@ -33,7 +34,6 @@ glances
glow
gnome-keyring
go
gopass
grub
hugo
i3-gaps
@ -78,6 +78,7 @@ ntp
os-prober
pacman-contrib
pandoc-citeproc
pass
pavolume
pdfjs
pia-tools

View file

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

View file

@ -1,9 +1,7 @@
All=*
Inbox=tag:inbox and not tag:archived and not tag:dump
Archive=tag:archived and not tag:inbox and not tag:dump
Inbox=tag:inbox and not tag:lists
Archive=not tag:inbox and not tag:deleted and not tag:dump
Dump=tag:dump and not tag:inbox
Trash=tag:deleted
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
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
messages = acc["Inbox"]:contain_from(sender)
messages = folderFrom:contain_from(sender)
messages:mark_seen()
messages:move_messages(acc["Dump"])
-- 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
messages:move_messages(folderTo)
end
end
for _, acc in pairs(accounts) do
sendtoRollup ( acc, {
sendToFolder ( acc["Inbox"], acc["Dump"],
{
"news@todoist.com",
"server@email.woommart.com",
"noreply@medium.com",
@ -34,6 +28,8 @@ for _, acc in pairs(accounts) do
"waitlist@isthereanydeal.com",
"info@mynameisgriz.com",
"news@postman.com",
"no-reply@tumblr.com",
"contact@mailer.humblebundle.com",
"info@audible.de"
})
end

View file

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