From acaebdf0a4d0d1f032b05fabc755432859692d14 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Tue, 29 Oct 2024 11:38:43 +0530 Subject: [PATCH] mutt: Add email accounts for our own domains Switch to Migadu for our own domains. Migadu mandates bringing your own domain for email and as such we can now have separate mail boxes for both our .com & .net domains. We will drop fastmail once our plan expires. Also lots of clean up. Seems per account key binds were broken pretty much ever since these were added. --- mutt/.mutt/accounts/asymptotic | 19 ++++------- mutt/.mutt/accounts/fastmail | 28 +++------------- mutt/.mutt/accounts/sanchayan | 21 +++--------- mutt/.mutt/accounts/sanchayan-com | 11 ++++++ mutt/.mutt/accounts/sanchayan-net | 25 ++++++++++++++ mutt/.mutt/accounts/victor | 18 ---------- mutt/.mutt/mailnotify.sh | 23 ++++++++++--- mutt/.mutt/muttrc | 56 +++++++++++++++++++------------ 8 files changed, 104 insertions(+), 97 deletions(-) create mode 100644 mutt/.mutt/accounts/sanchayan-com create mode 100644 mutt/.mutt/accounts/sanchayan-net delete mode 100644 mutt/.mutt/accounts/victor diff --git a/mutt/.mutt/accounts/asymptotic b/mutt/.mutt/accounts/asymptotic index 1317b6f..01da668 100644 --- a/mutt/.mutt/accounts/asymptotic +++ b/mutt/.mutt/accounts/asymptotic @@ -1,21 +1,14 @@ # vim: syntax=muttrc set from = "Sanchayan Maity " -set sendmail = "/usr/bin/msmtp -a asymptotic" +set sendmail = "msmtp -a asymptotic" set mbox = "+asymptotic/Archive" -set postponed = "+asymptotic/drafts" +set postponed = "+asymptotic/Drafts" set record = "+asymptotic/Sent" set signature = "~/.mutt/signature" -color status green default +macro index S +asymptotic/Spam +macro index D +asymptotic/Trash -macro index D \ - "+asymptotic/Trash" \ - "move message to the trash" - -macro index S \ - "+asymptotic/Spam" \ - "mark message as spam" - -macro index gi "=asymptotic/Inbox" "Go to Inbox" -macro index gs "=asymptotic/Sent" "Go to Sent" +macro index gi =asymptotic/Inbox +macro index gs =asymptotic/Sent diff --git a/mutt/.mutt/accounts/fastmail b/mutt/.mutt/accounts/fastmail index c5d8ea3..b3c3199 100644 --- a/mutt/.mutt/accounts/fastmail +++ b/mutt/.mutt/accounts/fastmail @@ -1,32 +1,14 @@ # vim: syntax=muttrc -set from = "Sanchayan Maity " -set sendmail = "/usr/bin/msmtp -a fastmail" +set from = "Sanchayan Maity " +set sendmail = "msmtp -a fastmail" set mbox = "+fastmail/Archive" -set postponed = "+fastmail/drafts" +set postponed = "+fastmail/Drafts" set record = "+fastmail/Sent" set signature = "~/.mutt/signature" -color status green default - -macro index D \ - "+fastmail/Trash" \ - "move message to the trash" - -macro index S \ - "+fastmail/Spam" \ - "mark message as spam" - -# Binding 'gi' will alias 'g' -bind index g noop +macro index D +fastmail/Trash +macro index S +fastmail/Spam macro index gi "=fastmail/Inbox" "Go to Inbox" -macro index gf "=fastmail/FreedesktopGitlab" "Go to Freedesktop GitLab" -macro index gg "=fastmail/gstreamer" "Go to GStreamer" macro index gs "=fastmail/Sent" "Go to Sent" -macro index ge "=fastmail/ietf" "Go to IETF" -macro index gc "=fastmail/Coffee" "Go to Coffee" - -# See send-hook and patterns here http://www.mutt.org/doc/manual/#patterns -#send-hook . 'reset crypt_autoencrypt' -#send-hook '~f sanchayan@sanchayanmaity\\.net' 'set crypt_autosign' diff --git a/mutt/.mutt/accounts/sanchayan b/mutt/.mutt/accounts/sanchayan index bef3558..f2d21d0 100644 --- a/mutt/.mutt/accounts/sanchayan +++ b/mutt/.mutt/accounts/sanchayan @@ -1,24 +1,11 @@ # vim: syntax=muttrc set from = "Sanchayan Maity " -set sendmail = "/usr/bin/msmtp -a Sanchayan" +set sendmail = "msmtp -a Sanchayan" set mbox = "+sanchayan/Archive" -set postponed = "+sanchayan/drafts" +set postponed = "+sanchayan/Drafts" set record = "+sanchayan/Sent" set signature = "~/.mutt/signature" -color status green default - -macro index D \ - "+sanchayan/Trash" \ - "move message to the trash" - -macro index S \ - "+sanchayan/Spam" \ - "mark message as spam" - -macro index gi "=sanchayan/Inbox" "Go to Inbox" -macro index gf "=sanchayan/FreedesktopGitlab" "Go to freedesktop gitlab" -macro index gg "=sanchayan/gstreamer" "Go to gstreamer" -macro index gp "=sanchayan/pulseaudio" "Go to pulseaudio" -macro index gs "=sanchayan/Sent" "Go to Sent" +macro index S +sanchayan/Spam +macro index D +sanchayan/Trash diff --git a/mutt/.mutt/accounts/sanchayan-com b/mutt/.mutt/accounts/sanchayan-com new file mode 100644 index 0000000..fd870f1 --- /dev/null +++ b/mutt/.mutt/accounts/sanchayan-com @@ -0,0 +1,11 @@ +# vim: syntax=muttrc + +set from = "Sanchayan Maity " +set sendmail = "msmtp -a sanchayan-com" +set mbox = "+sanchayan-com/Archive" +set postponed = "+sanchayan-com/Drafts" +set record = "+sanchayan-com/Sent" +set signature = "~/.mutt/signature" + +macro index J +sanchayan-com/Junk +macro index D +sanchayan-com/Trash diff --git a/mutt/.mutt/accounts/sanchayan-net b/mutt/.mutt/accounts/sanchayan-net new file mode 100644 index 0000000..d5fa8ac --- /dev/null +++ b/mutt/.mutt/accounts/sanchayan-net @@ -0,0 +1,25 @@ +# vim: syntax=muttrc + +set from = "Sanchayan Maity " +set sendmail = "msmtp -a sanchayan-net" +set mbox = "+sanchayan-net/Archive" +set postponed = "+sanchayan-net/Drafts" +set record = "+sanchayan-net/Sent" +set signature = "~/.mutt/signature" + +macro index J +sanchayan-net/Junk +macro index D +sanchayan-net/Trash + +macro index gi =sanchayan-net/Inbox +macro index gf =sanchayan-net/FreedesktopGitlab +macro index gg =sanchayan-net/gstreamer +macro index gs =sanchayan-net/Sent +macro index ge =sanchayan-net/ietf +macro index gc =sanchayan-net/Coffee +macro index gt =sanchayan-net/Trash +macro index gj =sanchayan-net/Junk +macro index gS =sanchayan-net/Spam + +# See send-hook and patterns here http://www.mutt.org/doc/manual/#patterns +#send-hook . 'reset crypt_autoencrypt' +#send-hook '~f sanchayan@sanchayanmaity\\.net' 'set crypt_autosign' diff --git a/mutt/.mutt/accounts/victor b/mutt/.mutt/accounts/victor deleted file mode 100644 index 45f9bcf..0000000 --- a/mutt/.mutt/accounts/victor +++ /dev/null @@ -1,18 +0,0 @@ -# vim: syntax=muttrc - -set from = "victorascroft@gmail.com" -set sendmail = "/usr/bin/msmtp -a Victor" -set mbox = "+victor/Archive" -set postponed = "+victor/Drafts" -set record = "+victor/Sent" -set signature = "~/.mutt/signature" - -color status cyan default - -macro index D \ - "+victor/Trash" \ - "move message to the trash" - -macro index S \ - "+victor/Spam" \ - "mark message as spam" diff --git a/mutt/.mutt/mailnotify.sh b/mutt/.mutt/mailnotify.sh index 81e3b95..53e0741 100755 --- a/mutt/.mutt/mailnotify.sh +++ b/mutt/.mutt/mailnotify.sh @@ -1,14 +1,31 @@ #!/bin/bash +# Without this pinentry-gtk does not get triggered to ask for GPG password. export DISPLAY=:0 -imapfilter -c ~/.imapfilter/config.lua +imapfilter # find also outputs the directory itself it is given as input and since we # count the lines in output for checking the number of mails, this gives -# a result of 1 when no mails have been received. For this, we substract 1 +# a result of 1 when no mails have been received. For this, we subtract 1 # from the result of our command. +if [ -d "$HOME/Mail/sanchayan-net" ]; then + mbsync sanchayan-net + inbox=$(($(find ~/Mail/sanchayan-net/Inbox/new | wc -l)-1)) + if [ "$inbox" -gt 0 ]; then + notify-send "You have $inbox new mails in sanchayanmaity.net inbox" + fi +fi + +if [ -d "$HOME/Mail/sanchayan-com" ]; then + mbsync sanchayan-com + inbox=$(($(find ~/Mail/sanchayan-com/Inbox/new | wc -l)-1)) + if [ "$inbox" -gt 0 ]; then + notify-send "You have $inbox new mails in sanchayanmaity.com inbox" + fi +fi + if [ -d "$HOME/Mail/fastmail" ]; then mbsync fastmail fastmail_inbox=$(($(find ~/Mail/fastmail/Inbox/new | wc -l)-1)) @@ -36,5 +53,3 @@ if [ -d "$HOME/Mail/asymptotic" ]; then notify-send "You have $asymptotic_inbox new mails in asymptotic inbox" fi fi - -notmuch new diff --git a/mutt/.mutt/muttrc b/mutt/.mutt/muttrc index 3d7034b..fcebe5c 100644 --- a/mutt/.mutt/muttrc +++ b/mutt/.mutt/muttrc @@ -2,17 +2,21 @@ set mbox_type = Maildir set folder = ~/Mail -set spoolfile = +/fastmail/Inbox -set header_cache=~/Mail/mutt_cache/ # a much faster opening of mailboxes... +set spoolfile = +/sanchayan-net/Inbox +set header_cache=~/Mail/.mutt_cache/ source ~/.mutt/gpgrc -source ~/.mutt/accounts/fastmail +source ~/.mutt/accounts/sanchayan-net +source ~/.mutt/accounts/sanchayan-com source ~/.mutt/accounts/sanchayan source ~/.mutt/accounts/asymptotic +source ~/.mutt/accounts/fastmail -folder-hook fastmail/* source ~/.mutt/accounts/fastmail -folder-hook sanchayan/* source ~/.mutt/accounts/sanchayan -folder-hook asymptotic/* source ~/.mutt/accounts/asymptotic +folder-hook sanchayan-net/* source ~/.mutt/accounts/sanchayan-net +folder-hook sanchayan-com/* source ~/.mutt/accounts/sanchayan-com +folder-hook sanchayan/* source ~/.mutt/accounts/sanchayan +folder-hook asymptotic/* source ~/.mutt/accounts/asymptotic +folder-hook fastmail/* source ~/.mutt/accounts/fastmail set mail_check = 0 set envelope_from @@ -64,10 +68,6 @@ set mailcap_path = ~/.mutt/mailcap auto_view text/html alternative_order text/plain text/html -## Abook -set query_command= "abook --mutt-query '%s'" -macro index,pager A "abook --add-email-quiet" - ## Add this sender to Abook bind editor complete-query @@ -83,9 +83,11 @@ macro index a "all\n" "show all messages (undo limit)" bind index c noop macro index C '?^K=' +macro index cn 'source ~/.mutt/muttrc/accounts/sanchayan-net=sanchayan-net/Inbox/' +macro index cc 'source ~/.mutt/muttrc/accounts/sanchayan-com=sanchayan-com/Inbox/' +macro index cg 'source ~/.mutt/muttrc/accounts/sanchayan=sanchayan/Inbox/' macro index ca 'source ~/.mutt/muttrc/accounts/asymptotic=asymptotic/Inbox/' macro index cf 'source ~/.mutt/muttrc/accounts/fastmail=fastmail/Inbox/' -macro index cg 'source ~/.mutt/muttrc/accounts/sanchayan=sanchayan/Inbox/' macro index ,so "l ^a^k^O\n" "show old messages only" macro index ,sn "l ^a^k~N\n" "show unread/new only" @@ -107,23 +109,33 @@ bind index,pager \Cp sidebar-prev bind index,pager \Cn sidebar-next bind index,pager \Co sidebar-open -mailboxes = +fastmail/Inbox -mailboxes = +fastmail/gstreamer -mailboxes = +fastmail/FreedesktopGitlab -mailboxes = +fastmail/pulseaudio -mailboxes = +fastmail/Sent -mailboxes = +fastmail/Spam +mailboxes = +sanchayan-net/Inbox +mailboxes = +sanchayan-net/Coffee +mailboxes = +sanchayan-net/ietf +mailboxes = +sanchayan-net/gstreamer +mailboxes = +sanchayan-net/FreedesktopGitlab +mailboxes = +sanchayan-net/Sent +mailboxes = +sanchayan-net/Spam +mailboxes = +sanchayan-net/Trash -mailboxes = +asymptotic/Inbox -mailboxes = +asymptotic/Sent +mailboxes = +sanchayan-com/Inbox +mailboxes = +sanchayan-com/Sent +mailboxes = +sanchayan-com/Spam +mailboxes = +sanchayan-com/Trash mailboxes = +sanchayan/Inbox -mailboxes = +sanchayan/gstreamer -mailboxes = +sanchayan/FreedesktopGitlab -mailboxes = +sanchayan/pulseaudio mailboxes = +sanchayan/Sent mailboxes = +sanchayan/Spam +mailboxes = +asymptotic/bluez +mailboxes = +asymptotic/Inbox +mailboxes = +asymptotic/Sent +mailboxes = +asymptotic/Trash + +mailboxes = +fastmail/Inbox +mailboxes = +fastmail/Sent +mailboxes = +fastmail/Spam + # GPG signing options set crypt_autosign = "no" set crypt_replyencrypt = "yes"