From 8e13717228c7a8ef37c5b2811b5cd2fac9f22c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20N=C3=A1jera?= Date: Sun, 9 Aug 2020 12:08:54 +0200 Subject: Import personal email processing --- .config/afew/config | 35 +++++++++++++ .local/bin/tagmail.sh | 44 ++++++++++++++++ .mbsyncrc | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++ .notmuch-config | 102 ++++++++++++++++++++++++++++++++++++ 4 files changed, 321 insertions(+) create mode 100644 .config/afew/config create mode 100755 .local/bin/tagmail.sh create mode 100644 .mbsyncrc create mode 100644 .notmuch-config diff --git a/.config/afew/config b/.config/afew/config new file mode 100644 index 0000000..3c9853a --- /dev/null +++ b/.config/afew/config @@ -0,0 +1,35 @@ +# -*- mode: conf-unix -*- +# This is the default filter chain +[SpamFilter] +[KillThreadsFilter] +[ListMailsFilter] +[SentMailsFilter] +sent_tag = sent +[ArchiveSentMailsFilter] + +[Filter.2] +message = "Tag meetups info mails" +query = from:info@meetup.com +tags = +meetups;-new + +[Filter.3] +message = "Tag reports from ingrid" +query = from:postmaster@oscarnajera.com or from:root@oscarnajera.com +tags = +ingrid;-new + +[Filter.4] +message = "Tag the syndicate.vc" +query = from:thesyndicate.vc +tags = +syndicatevc;-new + +[Filter.5] +message = "Fail2ban report" +query = subject:Fail2Ban from:najera.pw +tags = +fail2ban;-new + +[Filter.6] +message = "Tag the fringe.fm" +query = from:fringe.fm +tags = +fringe.fm;-new + +[InboxFilter] diff --git a/.local/bin/tagmail.sh b/.local/bin/tagmail.sh new file mode 100755 index 0000000..ea3616b --- /dev/null +++ b/.local/bin/tagmail.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +if [[ -z $DBUS_SESSION_BUS_ADDRESS ]]; then + source /tmp/.Xdbus +fi + +# delete mail +notmuch search --output=files tag:deleted | xargs -I {} rm -v "{}" + +# Mail download +if [ -z "$1" ] +then + echo "syncing all mailboxes" + mbsync -a +else + echo "syncing $1 mailbox" + mbsync "$1" +fi + +# Notmuch tagging +notmuch new + +notmuch tag +ci -new -- from:travis-ci.com or from:travis-ci.org or from:appveyor.com or from:circleci.com +notmuch tag +ci -new -- from:mg.gitlab.com and subject:Pipeline +notmuch tag +CMK-JIRA -inbox -new -- from:infra@mathias-kettner.de or from:jira@tribe29.com +notmuch tag +alle-mk -new -- to:alle@mathias-kettner.de to:technik@tribe29.com +notmuch tag +cmk-commits -new -- to:cmk-internal-commits@mathias-kettner.de and subject:\[cmk\] +notmuch tag +mkde-commits -new -- to:cmk-internal-commits@mathias-kettner.de and subject:\[mkde\] +notmuch tag +cmc-commits -new -- to:cmk-internal-commits@mathias-kettner.de and subject:\[cmc\] +notmuch tag +cma-commits -new -- to:cma-commits@mathias-kettner.de and subject:\[cma\] +notmuch tag +immonews -new -- from:immobilienscout24.de +notmuch tag +immonews/communications -new -- from:nachrichten.immobilienscout24.de or subject:Kontaktaufnahme and tag:immonews +notmuch tag +socialnews -new -- from:facebookmail.com or from:mail.instagram.com +notmuch tag +linkedin +socialnews -new -- from:linkedin.com +notmuch tag +promotions -- from:newsletter +notmuch tag +toastmasters -- toastmaster NOT from:info@meetup.com + +notmuch tag +sms -inbox -- folder:hi_pers/SMS +notmuch tag +calls -inbox -- folder:hi_pers/Calls + +# afew tagging +afew --tag --new -v + +notmuch tag -inbox -- tag:lists diff --git a/.mbsyncrc b/.mbsyncrc new file mode 100644 index 0000000..3e3e7d6 --- /dev/null +++ b/.mbsyncrc @@ -0,0 +1,140 @@ +############################################################################### +# GMAIL + +IMAPAccount gmail +# Address to connect to +Host imap.gmail.com +User najera.oscar@gmail.com +PassCmd "pass show google/googlemail.com/najera.oscar" +AuthMechs LOGIN +# Use SSL +SSLType IMAPS +# The following line should work. If get certificate errors, uncomment the two following lines and read the "Troubleshooting" section. +CertificateFile /etc/ssl/certs/ca-certificates.crt +#CertificateFile ~/.cert/imap.gmail.com.pem +#CertificateFile ~/.cert/Equifax_Secure_CA.pem + +IMAPStore gmail-remote +Account gmail + +MaildirStore gmail-local +# The trailing "/" is important +Path ~/.mail/gmail/ +Inbox ~/.mail/gmail/Inbox +SubFolders Legacy + +Channel gmail +Master :gmail-remote: +Slave :gmail-local: +# Exclude everything under the internal [Gmail] folder, except the interesting folders +Patterns * ![Gmail]* "[Gmail]/Sent Mail" +# Or include everything +#Patterns * +# Automatically create missing mailboxes, both locally and on the server +Create Both +# Save the synchronization state files in the relevant directory +SyncState * +Expunge Both + +############################################################################### +# Personal +IMAPAccount hi_pers +Host git.oscarnajera.com +User hi@oscarnajera.com +PassCmd "pass show Correos/mail.oscarnajera.com" +AuthMechs LOGIN +SSLType IMAPS + +IMAPStore hi_pers-remote +Account hi_pers + +MaildirStore hi_pers-local +Path ~/.mail/hi_pers/ +Inbox ~/.mail/hi_pers/Inbox +SubFolders Verbatim + +Channel hi_pers +Master :hi_pers-remote: +Slave :hi_pers-local: +Patterns * +Create Both +SyncState * +Expunge Both + +############################################################################### +# AMZbooks +IMAPAccount kindle +Host git.oscarnajera.com +User kindle@oscarnajera.com +PassCmd "pass show Correos/kindle@oscarnajera.com" +AuthMechs LOGIN +SSLType IMAPS + +IMAPStore kindle-remote +Account kindle + +MaildirStore kindle-local +Path ~/.mail/kindle/ +Inbox ~/.mail/kindle/Inbox +SubFolders Verbatim + +Channel kindle +Master :kindle-remote: +Slave :kindle-local: +Patterns * +Create Both +SyncState * +Expunge Both + +############################################################################### +# Startup +IMAPAccount delightfuldying +Host git.oscarnajera.com +User oscar.najera@delightfuldying.com +PassCmd "pass show WebSites/delightfuldying.com/mailbox/julie" +AuthMechs LOGIN +SSLType IMAPS + +IMAPStore dd-remote +Account delightfuldying + +MaildirStore dd-local +Path ~/.mail/dd/ +Inbox ~/.mail/dd/Inbox +SubFolders Verbatim + +Channel delightfuldying +Master :dd-remote: +Slave :dd-local: +Patterns * +Create Both +SyncState * +Expunge Both + +############################################################################### +# Startup +IMAPAccount fallforward +Host git.oscarnajera.com +User sarah@fallforward.space +PassCmd "pass show WebSites/fallforward.space/mailbox/sarah" +AuthMechs LOGIN +SSLType IMAPS + +IMAPStore ff-remote +Account fallforward + +MaildirStore ff-local +Path ~/.mail/ff/ +Inbox ~/.mail/ff/Inbox +SubFolders Verbatim + +Channel fallforward +Master :ff-remote: +Slave :ff-local: +Patterns * +Create Both +SyncState * +Expunge Both +# Local Variables: +# mode: conf-unix +# End: diff --git a/.notmuch-config b/.notmuch-config new file mode 100644 index 0000000..e74011c --- /dev/null +++ b/.notmuch-config @@ -0,0 +1,102 @@ +# -*- mode: conf-unix -*- +# .notmuch-config - Configuration file for the notmuch mail system +# +# For more information about notmuch, see https://notmuchmail.org + +# Database configuration +# +# The only value supported here is 'path' which should be the top-level +# directory where your mail currently exists and to where mail will be +# delivered in the future. Files should be individual email messages. +# Notmuch will store its database within a sub-directory of the path +# configured here named ".notmuch". +# +[database] +path=.mail + +# User configuration +# +# Here is where you can let notmuch know how you would like to be +# addressed. Valid settings are +# +# name Your full name. +# primary_email Your primary email address. +# other_email A list (separated by ';') of other email addresses +# at which you receive email. +# +# Notmuch will use the various email addresses configured here when +# formatting replies. It will avoid including your own addresses in the +# recipient list of replies, and will set the From address based on the +# address to which the original email was addressed. +# +[user] +name=Oscar Najera +primary_email=hi@oscarnajera.com +other_email=hello@oscarnajera.com;najera.oscar@gmail.com;oscar.najera-ocampo@u-psud.fr;on@mathias-kettner.de + +# Configuration for "notmuch new" +# +# The following options are supported here: +# +# tags A list (separated by ';') of the tags that will be +# added to all messages incorporated by "notmuch new". +# +# ignore A list (separated by ';') of file and directory names +# that will not be searched for messages by "notmuch new". +# +# NOTE: *Every* file/directory that goes by one of those +# names will be ignored, independent of its depth/location +# in the mail store. +# +[new] +#tags=unread;inbox; +tags=new; +ignore=.uidvalidity;.mbsyncstate;.directory + +# Search configuration +# +# The following option is supported here: +# +# exclude_tags +# A ;-separated list of tags that will be excluded from +# search results by default. Using an excluded tag in a +# query will override that exclusion. +# +[search] +exclude_tags=deleted;spam; + +# Maildir compatibility configuration +# +# The following option is supported here: +# +# synchronize_flags Valid values are true and false. +# +# If true, then the following maildir flags (in message filenames) +# will be synchronized with the corresponding notmuch tags: +# +# Flag Tag +# ---- ------- +# D draft +# F flagged +# P passed +# R replied +# S unread (added when 'S' flag is not present) +# +# The "notmuch new" command will notice flag changes in filenames +# and update tags, while the "notmuch tag" and "notmuch restore" +# commands will notice tag changes and update flags in filenames +# +[maildir] +synchronize_flags=true + +# Cryptography related configuration +# +# The following *deprecated* option is currently supported: +# +# gpg_path +# binary name or full path to invoke gpg. +# NOTE: In a future build, this option will be ignored. +# Setting $PATH is a better approach. +# +[crypto] +gpg_path=gpg -- cgit v1.2.3