clone of my dotfiles.ssp.sh
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

neomut with notmuch config

sspaeti 344d0712 cd26673b

+1288 -124
+1 -1
.gitignore
··· 18 18 **/*.secret 19 19 **/*.key 20 20 .env.local 21 - 21 + zsh/.dotfiles/mutt/.lists 22 22 23 23 #obsidian 24 24 obsidian/Simon/SecondBrain/.obsidian/workspace
+62 -7
mutt/.config/mutt/Makefile
··· 1 - .PHONY: start logs help 1 + .PHONY: loop logs help notmuch-loop notmuch-sync sync notmuch-logs notmuch-screen notmuch-init 2 + 3 + .DEFAULT_GOAL := notmuch-loop 4 + 5 + # Notmuch mail sync loop with mbsync (default) 6 + notmuch-loop: 7 + @echo "Starting notmuch mail sync loop (10 minute intervals)..." 8 + @echo "Press Ctrl+C to stop" 9 + @while true; do \ 10 + ~/.config/mutt/notmuch/sync/mbsync_notmuch_sync.sh; \ 11 + echo "Sleeping for 10 minutes..."; \ 12 + sleep 600; \ 13 + done 14 + 15 + # Run complete sync once (mbsync → notmuch index → screening → mbsync) 16 + notmuch-sync: 17 + ~/.config/mutt/notmuch/sync/mbsync_notmuch_sync.sh 18 + 19 + # Alias for notmuch-sync 20 + sync: notmuch-sync 21 + 22 + # Show notmuch sync logs 23 + notmuch-logs: 24 + tail -f ~/.config/mutt/logs/mbsync_notmuch_sync_status.log 25 + 26 + # Show notmuch screening logs 27 + notmuch-screen-logs: 28 + tail -f ~/.config/mutt/logs/notmuch_screening.log 29 + 30 + # Run notmuch screening manually 31 + notmuch-screen: 32 + ~/.config/mutt/notmuch/notmuch_screening.sh 33 + 34 + # Initialize notmuch database 35 + notmuch-init: 36 + @echo "Initializing notmuch database..." 37 + @echo "Database path: /home/sspaeti/Documents/mutt/sspaeti.com" 38 + NOTMUCH_CONFIG=~/.config/mutt/notmuch/notmuch-config notmuch new 2 39 3 - .DEFAULT_GOAL := loop 40 + #count emails 41 + count-emails: 42 + find ~/Documents/mutt/sspaeti.com -type f | wc -l 4 43 5 - # Start mail sync 44 + # Legacy aliases (folder-based system) 6 45 loop: 7 46 ~/.config/mutt/launchctl/mail_sync_watch.sh --loop 8 47 9 - # Show logs 10 48 logs: 11 49 tail -f ~/.config/mutt/logs/mail_sync.log 12 50 13 51 # Show help 14 52 help: 15 53 @echo "Mail Sync Makefile commands:" 16 - @echo " make start - Start mail sync loop" 17 - @echo " make logs - Show mail sync logs" 18 54 @echo "" 19 - @echo "Note: Use Ctrl+C to stop the sync" 55 + @echo "=== Quick Commands ===" 56 + @echo " make sync - Sync everything once (fetch → screen → sync back)" 57 + @echo " make - Start continuous sync loop (same as notmuch-loop)" 58 + @echo "" 59 + @echo "=== Notmuch (tag-based system - DEFAULT) ===" 60 + @echo " make notmuch-loop - Start notmuch sync loop (10 min intervals)" 61 + @echo " make notmuch-sync - Run complete sync once (same as 'make sync')" 62 + @echo " make notmuch-screen - Run notmuch screening manually" 63 + @echo " make notmuch-init - Initialize/reindex notmuch database" 64 + @echo "" 65 + @echo "=== Logs ===" 66 + @echo " make notmuch-logs - Show notmuch sync logs" 67 + @echo " make notmuch-screen-logs - Show screening logs" 68 + @echo " make count-emails - Count total emails locally" 69 + @echo "" 70 + @echo "=== Legacy (folder-based system) ===" 71 + @echo " make loop - Start old mail sync loop" 72 + @echo " make logs - Show old mail sync logs" 73 + @echo "" 74 + @echo "Note: Use Ctrl+C to stop any running sync loop"
+69 -116
mutt/.config/mutt/muttrc
··· 1 1 2 + ### Notmuch-based email configuration ### 3 + # Source this instead of the regular muttrc to use tag-based email management 2 4 3 5 ### offline email ------------------------- 4 6 set folder = "~/Documents/mutt/sspaeti.com/" ··· 13 15 set text_flowed 14 16 15 17 ### Direct ------------------------------- 16 - # set folder = "imaps://simu@sspaeti.com@imap.mail.hostpoint.ch:993" 17 - # set smtp_url = "smtp://simu@sspaeti.com@asmtp.mail.hostpoint.ch:587" 18 - 19 - # set smpt password with ENV variable 20 - # set smtp_pass = "$HOSTSPINT_SMTP_PASSWORD_SIMU" 21 - # set imap_pass = "password" 22 18 source ~/.dotfiles/zsh/.secret.muttrc 23 19 24 20 set realname = "Simon Späti" ··· 33 29 macro compose <F2> "<enter-command>set sendmail='msmtp -a simon@sspaeti.com'<enter><enter-command>set from='simu@sspaeti.com'<enter>" 34 30 macro compose <F3> "<enter-command>set sendmail='msmtp -a simu@sspaeti.com'<enter><enter-command>set from='simon@ssp.sh'<enter>" 35 31 36 - macro index <F1> ":set from='simon@ssp.sh'\n:set sendmail='mssmtp -a simon@ssp.sh'\n" 37 - macro index <F2> ":set from='simon@sspaeti.com'\n:set sendmail='msmtp -a simon@sspaeti.com'\n" 38 - macro index <F3> ":set from='simu@sspaeti.com'\n:set sendmail='msmtp -a simu@sspaeti.com'\n" 32 + macro index <F1> ":set from='simon@ssp.sh'\\n:set sendmail='mssmtp -a simon@ssp.sh'\\n" 33 + macro index <F2> ":set from='simon@sspaeti.com'\\n:set sendmail='msmtp -a simon@sspaeti.com'\\n" 34 + macro index <F3> ":set from='simu@sspaeti.com'\\n:set sendmail='msmtp -a simu@sspaeti.com'\\n" 39 35 40 36 set spoolfile = "+INBOX" 41 37 set record = "+Sent" ··· 46 42 set ssl_starttls = yes 47 43 set ssl_force_tls = yes 48 44 49 - mailboxes =INBOX =ToScreen =ScreenedOut =Waiting =Scheduled =Someday =Sent =Trash =Drafts =Junk =Archive =Others =Feed =PaperTrail =Spam" 45 + ### NOTMUCH INTEGRATION ### 46 + set nm_default_url = "notmuch:///home/sspaeti/Documents/mutt/sspaeti.com" 47 + set nm_config_file = "~/.config/mutt/notmuch/notmuch-config" 48 + set virtual_spool_file = yes 50 49 50 + # Virtual mailboxes using notmuch queries (tag-based) 51 + virtual-mailboxes \ 52 + "INBOX" "notmuch://?query=tag:inbox and tag:screened-in and not tag:archive" \ 53 + "ToScreen" "notmuch://?query=tag:to-screen" \ 54 + "ScreenedOut" "notmuch://?query=tag:screened-out" \ 55 + "Waiting" "notmuch://?query=tag:waiting" \ 56 + "Scheduled" "notmuch://?query=tag:scheduled" \ 57 + "Someday" "notmuch://?query=tag:someday" \ 58 + "Sent" "notmuch://?query=tag:sent" \ 59 + "Trash" "notmuch://?query=tag:deleted" \ 60 + "Drafts" "notmuch://?query=tag:draft" \ 61 + "Junk" "notmuch://?query=tag:spam or tag:junk" \ 62 + "Archive" "notmuch://?query=tag:archive" \ 63 + "Feed" "notmuch://?query=tag:feed" \ 64 + "PaperTrail" "notmuch://?query=tag:papertrail" \ 65 + "Unread" "notmuch://?query=tag:unread" \ 66 + "All Mail" "notmuch://?query=*" 51 67 68 + # SCREENER - Notmuch version 69 + # Tag management macros instead of moving files 52 70 53 - # macro compose <F4> "<enter-command>set sendmail='/usr/bin/msmtp -a gmail.com'<enter><enter-command>set from='simon.spaeti@gmail.com'<enter>" 71 + # Screen In - add screened-in tag and move to inbox 72 + macro index,pager I "<pipe-message>formail -zx From: | grep -Eo '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}' | xargs -I {} echo {} >> ~/.dotfiles/mutt/.lists/screened_in.txt<enter><modify-labels>+screened-in +inbox -to-screen -new<enter>" "Screen in this sender" 54 73 55 - # SCREENER 56 - # 57 - ## Step 3: Decision Making Macros 74 + # Screen Out - add screened-out tag 75 + macro index,pager O "<pipe-message>formail -zx From: | grep -Eo '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}' | xargs -I {} echo {} >> ~/.dotfiles/mutt/.lists/screened_out.txt<enter><modify-labels>+screened-out +spam -inbox -to-screen<enter>" "Screen out this sender" 58 76 59 - # Screen In and move to Inbox 60 - # 1. Takes the current message and sends it through a pipeline for processing. 61 - # 2. Uses awk to extract the last field (email address) from the line that starts with From: . The $NF is a special awk variable that represents the last field in a record. 62 - # 3. Removes angle brackets from around the email address, which are commonly used in email headers. 63 - # 4. Appends the email address to the screened_in.txt file. 64 - # 5. Saves the message to the Inbox after the macro executes. 65 - #works better with MIME types. done with formail 66 - macro index,pager I "<pipe-message>formail -zx From: | awk '/@/ {print \$NF}' | tr -d '<>' | grep -Eo '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}' | xargs -I {} echo {} >> ~/.config/mutt/screened_in.txt<enter><save-message>~/Documents/mutt/sspaeti.com/INBOX<enter>y" "Screen in this sender" 67 - 68 - # this does: 69 - # 1. Appends the email address to the screened_out.txt file. 70 - # 2. Saves the message to a folder named ScreenedOut after execution. 71 - # macro index,pager O "<pipe-message>awk '/^From: / {print \$NF}' | tr -d '<>' | xargs -I {} echo {} >> ~/.config/mutt/screened_out.txt<enter><save-message>~/Documents/mutt/sspaeti.com/ScreenedOut<enter>y" "Screen out this sender" 72 - macro index,pager O "<pipe-message>formail -zx From: | grep -Eo '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}' | xargs -I {} echo {} >> ~/.config/mutt/screened_out.txt<enter><save-message>~/Documents/mutt/sspaeti.com/ScreenedOut<enter>y" "Screen out this sender" 73 - 74 - # add to Feed list 75 - # macro index,pager F "<pipe-message>awk -F'[<>]' '/^From: / {print \$2}' | tr -d '<>' | xargs -I {} echo {} >> ~/.config/mutt/feed.txt<enter><save-message>~/Documents/mutt/sspaeti.com/Feed<enter>y" "Add sender to Feed" 76 - macro index,pager F "<pipe-message>formail -zx From: | grep -Eo '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}' | xargs -I {} echo {} >> ~/.config/mutt/feed.txt<enter><save-message>~/Documents/mutt/sspaeti.com/Feed<enter>y" "Add sender to Feed" 77 - 78 - 79 - # add to papertrail list 80 - # macro index,pager P "<pipe-message>awk '/^From: / {print \$NF}' | tr -d '<>' | xargs -I {} echo {} >> ~/.config/mutt/papertrail.txt<enter><save-message>~/Documents/mutt/sspaeti.com/PaperTrail<enter>y" "Add sender to PaperTrail" 81 - macro index,pager P "<pipe-message>formail -zx From: | grep -Eo '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}' | xargs -I {} echo {} >> ~/.config/mutt/papertrail.txt<enter><save-message>~/Documents/mutt/sspaeti.com/PaperTrail<enter>y" "Add sender to PaperTrail" 77 + # Add to Feed list 78 + macro index,pager F "<pipe-message>formail -zx From: | grep -Eo '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}' | xargs -I {} echo {} >> ~/.dotfiles/mutt/.lists/feed.txt<enter><modify-labels>+feed -inbox -to-screen<enter>" "Add sender to Feed" 82 79 80 + # Add to PaperTrail list 81 + macro index,pager P "<pipe-message>formail -zx From: | grep -Eo '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}' | xargs -I {} echo {} >> ~/.dotfiles/mutt/.lists/papertrail.txt<enter><modify-labels>+papertrail -inbox -to-screen<enter>" "Add sender to PaperTrail" 83 82 84 - # ## old / archive 85 - # macro index,pager I "<pipe-message>awk '/^From: / {print \$NF}' | tr -d '<>' | xargs -I {} echo {} >> ~/.config/mutt/screened_in.txt<enter><save-message>~/Documents/mutt/sspaeti.com/INBOX<enter>y" "Screen in this sender" 86 - # macro index,pager O "<pipe-message>awk -F'[<>]' '/^From: / {print \$2}' | tr -d '<>' | xargs -I {} echo {} >> ~/.config/mutt/screened_out.txt<enter><save-message>~/Documents/mutt/sspaeti.com/ScreenedOut<enter>y" "Screen out this sender" 87 - # macro index,pager F "<pipe-message>awk '/^From: / {print \$NF}' | tr -d '<>' | xargs -I {} echo {} >> ~/.config/mutt/feed.txt<enter><save-message>~/Documents/mutt/sspaeti.com/Feed<enter>y" "Add sender to Feed" 88 - # macro index,pager F "<pipe-message>awk '/^From: / { match(\$0, /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}/, arr); if(arr[0] != \"\") print arr[0] }' | tr -d '<>' | xargs -I {} echo {} >> ~/.config/mutt/feed.txt<enter><save-message>~/Documents/mutt/sspaeti.com/Feed<enter>y" "Add sender to Feed" 89 - # macro index,pager F "<pipe-message>echo %{from}<enter> | ./extract_email.sh | xargs -I {} echo {} >> ~/.config/mutt/feed.txt<enter><save-message>~/Documents/mutt/sspaeti.com/Feed<enter>y" "Add sender to Feed" 90 - # macro index,pager P "<pipe-message>awk -F'[<>]' '/^From: / {print \$2}' | tr -d '<>' | xargs -I {} echo {} >> ~/.config/mutt/papertrail.txt<enter><save-message>~/Documents/mutt/sspaeti.com/PaperTrail<enter>y" "Add sender to PaperTrail" 91 - 92 - ## Step 6: Updating Lists and Filters 93 - set my_screen_update_macro="<shell-escape>~/.config/mutt/update_screen_lists.sh<enter>" 94 - # macro index F5 "<shell-escape>~/.config/mutt/update_screen_lists.sh<enter>" 95 - 83 + # Sync and screen 84 + macro index,pager S "<shell-escape>~/.config/mutt/notmuch/sync/notmuch_sync.sh<enter>" "Sync with notmuch" 85 + macro index,pager A "<shell-escape>~/.config/mutt/notmuch/notmuch_screening.sh >> ~/.config/mutt/logs/notmuch_screening.log 2>&1<enter>" "Run notmuch screening" 96 86 97 87 # Where to put the stuff 98 88 set header_cache = "~/.cache/mutt/headers" 99 89 set message_cachedir = "~/.cache/mutt/bodies" 100 90 set certificate_file = "~/.cache/mutt/certificates" 101 - #unset record 102 91 103 92 set signature = "~/.config/mutt/signature" 104 93 105 94 # link to mailcap file 106 95 set mailcap_path = "~/.config/mutt/mailcap" 107 96 # open attachments with mailcap with <return> 108 - bind attach <return> view-mailcap 97 + bind attach <return> view-mailcap 109 98 # save attachments to a folder 110 99 macro attach s '<save-entry> <bol>~/Documents/attachments/<eol>' 'save attachment' 111 100 auto_view text/html # automatically show html (mailcap uses lynx) ··· 113 102 #urlscan: open urls 114 103 macro index,pager \cb "<pipe-message> urlscan<Enter>" "call urlscan to extract URLs out of a message" 115 104 macro attach,compose \cb "<pipe-entry> urlscan<Enter>" "call urlscan to extract URLs out of a message" 116 - # macro pager \cb "|urlview\n" 117 105 118 106 # query 119 107 set query_command="/opt/homebrew/bin/lbdbq '%s'" ··· 128 116 bind index,pager C noop 129 117 130 118 # General rebindings 131 - # set editor = "nvim" 132 119 set editor="nvim -c 'setlocal filetype=markdown'" 133 120 # for proper quoting 134 121 set indent_string="> " 135 122 136 - 137 123 bind index gg first-entry 138 124 bind index j next-entry 139 125 bind index k previous-entry ··· 146 132 bind pager k previous-line 147 133 bind pager l view-attachments 148 134 149 - 150 135 #Vim navigation 151 - # Changed bindings for scrolling and deleting 152 136 bind index,pager d noop 153 137 bind index,pager,browser \Cd half-down 154 138 bind index,pager,browser \Cu half-up ··· 156 140 bind index,pager u half-up 157 141 bind index D delete-message 158 142 159 - # Global search macro (excluding ScreenedOut folder) 143 + # Global search macro 160 144 macro index \Cf "<limit>~B " "search in all folders" 161 - # appendix to add: <search term> & !~f ScreenedOut 162 145 163 146 # Unbind ESC+q from sort 164 147 unbind index,pager \eq 165 148 166 - # bind index U undelete-message 167 - # bind index L limit 168 149 bind index h noop 169 150 bind index l display-message 170 151 bind index,query <space> tag-entry 171 - #bind browser h goto-parent 172 152 macro browser h '<change-dir><kill-line>..<enter>' "Go to parent folder" 173 153 bind index,pager H view-raw-message 174 154 bind browser l select-entry ··· 176 156 bind browser G bottom-page 177 157 bind pager gg top 178 158 bind pager G bottom 179 - #sync & screener 180 - # macro index,pager S "<shell-escape>offlineimap -a sspaeti.com<enter><sync-mailbox><shell-escape>~/.config/mutt/initial_screening.sh >> ~/.config/mutt/logs/screening.log 2>&1<enter><sync-mailbox>" 181 - # both are seperate: 182 - macro index,pager S "<shell-escape>offlineimap -a sspaeti.com<enter><sync-mailbox>" 183 - # bind index,pager S sync-mailbox 184 - macro index,pager A "<shell-escape>~/.config/mutt/initial_screening.sh >> ~/.config/mutt/logs/screening.log 2>&1<enter><sync-mailbox>" 185 159 186 - 187 - # reomve selection 188 - # macro index U "T.t<enter>" 189 - # macro index U "<tag-pattern>.<enter>;<tag-toggle><enter>" 160 + # Remove selection 190 161 macro index U "<tag-pattern>.<enter>;t<enter>" 191 162 192 - 193 - 194 - 195 - 196 163 bind index,pager R group-reply 197 164 bind index \031 previous-undeleted # Mouse wheel 198 165 bind index \005 next-undeleted # Mouse wheel ··· 200 167 bind pager \005 next-line # Mouse wheel 201 168 bind editor <Tab> complete-query 202 169 170 + ## Tag-based folder navigation (using notmuch virtual mailboxes) 171 + macro index,pager gi "<change-vfolder>INBOX<enter>" "go to INBOX" 172 + macro index,pager Mi "<modify-labels>+inbox +screened-in -to-screen -screened-out -feed -papertrail<enter>" "tag as inbox" 203 173 204 - ## Move, copy and go to folders mappings 205 - macro index,pager gi "<change-folder>=INBOX<enter>" "go to INBOX" 206 - macro index,pager Mi ";<save-message>=INBOX<enter>y" "move mail to INBOX" 174 + macro index,pager gd "<change-vfolder>Drafts<enter>" "go to drafts" 175 + macro index,pager Md "<modify-labels>+draft<enter>" "tag as draft" 207 176 208 - macro index,pager gd "<change-folder>=Drafts<enter>" "go to drafts" 209 - macro index,pager Md ";<save-message>=Drafts<enter>y" "move mail to drafts" 177 + macro index,pager gj "<change-vfolder>Junk<enter>" "go to junk" 178 + macro index,pager Mj "<modify-labels>+junk +spam -inbox<enter>" "tag as junk" 210 179 211 - macro index,pager gj "<change-folder>=Junk<enter>" "go to junk" 212 - macro index,pager Mj ";<save-message>=Junk<enter>y" "move mail to junk" 180 + macro index,pager gt "<change-vfolder>Trash<enter>" "go to trash" 181 + macro index,pager Mt "<modify-labels>+deleted -inbox<enter>" "tag as trash" 213 182 214 - macro index,pager gt "<change-folder>=Trash<enter>" "go to trash" 215 - macro index,pager Mt ";<save-message>=Trash<enter>y" "move mail to trash" 183 + macro index,pager gs "<change-vfolder>Sent<enter>" "go to sent" 216 184 217 - macro index,pager gs "<change-folder>=Sent<enter>" "go to sent" 218 - 219 - macro index,pager gm "<change-folder>=Someday<enter>" "go to Someday" 220 - macro index,pager Mm ";<save-message>=Someday<enter>" "move mail to Someday" 185 + macro index,pager gm "<change-vfolder>Someday<enter>" "go to Someday" 186 + macro index,pager Mm "<modify-labels>+someday -inbox<enter>" "tag as someday" 221 187 222 - macro index,pager ga "<change-folder>=Archive<enter>" "go to archive" 223 - macro index,pager Ma ";<save-message>=Archive<enter>y" "move mail to archive" 188 + macro index,pager ga "<change-vfolder>Archive<enter>" "go to archive" 189 + macro index,pager Ma "<modify-labels>+archive -inbox<enter>" "tag as archive" 224 190 225 - macro index,pager gw "<change-folder>=Waiting<enter>" "go to waiting" 226 - macro index,pager Mw ";<save-message>=Waiting<enter>y" "move mail to waiting" 191 + macro index,pager gw "<change-vfolder>Waiting<enter>" "go to waiting" 192 + macro index,pager Mw "<modify-labels>+waiting -inbox<enter>" "tag as waiting" 227 193 228 - macro index,pager gk "<change-folder>=ToScreen<enter>" "go to screener" 194 + macro index,pager gk "<change-vfolder>ToScreen<enter>" "go to screener" 229 195 230 - macro index,pager gf "<change-folder>=Feed<enter>" "go to Feed" 231 - macro index,pager Mf ";<save-message>=Feed<enter>y" "move mail to Feed" 196 + macro index,pager gf "<change-vfolder>Feed<enter>" "go to Feed" 197 + macro index,pager Mf "<modify-labels>+feed -inbox<enter>" "tag as feed" 232 198 233 - macro index,pager gp "<change-folder>=PaperTrail<enter>" "go to PaperTrail" 234 - macro index,pager Mp ";<save-message>=PaperTrail<enter>y" "move mail to PaperTrail" 199 + macro index,pager gp "<change-vfolder>PaperTrail<enter>" "go to PaperTrail" 200 + macro index,pager Mp "<modify-labels>+papertrail -inbox<enter>" "tag as papertrail" 235 201 236 - macro index,pager go "<change-folder>=ScreenedOut<enter>" "go to screened out" 237 - macro index,pager Mo ";<save-message>=ScreenedOut<enter>y" "move mail to screened out" 202 + macro index,pager go "<change-vfolder>ScreenedOut<enter>" "go to screened out" 203 + macro index,pager Mo "<modify-labels>+screened-out +spam -inbox<enter>" "tag as screened out" 238 204 239 205 macro index,pager gl "<show-log-messages><enter>" "go to log messages" 240 206 241 207 # Sidebar mappings 242 208 set sidebar_visible = yes 243 209 set sidebar_on_right = yes 244 - set sidebar_width = 20 210 + set sidebar_width = 30 245 211 set sidebar_short_path = yes 246 212 set sidebar_next_new_wrap = yes 247 213 set mail_check_stats 248 - # set sidebar_format = '%D%?F? [%F]?%* %?N?%N/? %?S?%S?' 249 214 set sidebar_format = "%B %* [%?N?%N / ?%S]" 250 215 bind index,pager \Ck sidebar-prev 251 216 bind index,pager \Cj sidebar-next ··· 253 218 bind index,pager \Cp sidebar-prev-new 254 219 bind index,pager \Cn sidebar-next-new 255 220 bind index,pager B sidebar-toggle-visible 256 - 257 221 258 222 # general settings from seniormars 259 - set pager_index_lines = 10 223 + set pager_index_lines = 10 260 224 set pager_context = 3 # show 3 lines of context 261 225 set pager_stop # stop at end of message 262 226 set menu_scroll # scroll menu ··· 264 228 set move=no # don't move messages when marking as read 265 229 set mail_check = 30 # check for new mail every 30 seconds 266 230 set imap_keepalive = 900 # 15 minutes 267 - set sleep_time = 0 # don't sleep when idle 231 + set sleep_time = 0 # don't sleep when idle 268 232 set wait_key = no # mutt won't ask "press key to continue" 269 233 set envelope_from # which from? 270 234 set edit_headers # show headers when composing ··· 290 254 set sort = reverse-threads 291 255 set sort_aux = last-date-received 292 256 # How we reply and quote emails. 293 - set reply_regexp = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*" 257 + set reply_regexp = "^(([Rr][Ee]?(\\[[0-9]+\\])?: *)?(\\[[^]]+\\] *)?)*" 294 258 set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+" 295 259 set send_charset = "utf-8:iso-8859-1:us-ascii" # send in utf-8 296 260 297 261 #Convert to HTML when hitting `m` for composing email 298 - # from: https://tom.wemyss.net/posts/neomutt-markdown-email/#2-set-up-a-pandoc-template-for-html-emails 299 - # 300 - # how it works: 301 - # Before pressing ‘y’ to send the message: 302 - # 1. Press ‘m’ to run the macro. All being well, this will automatically create another inline attachment containing both the HTML and the plain text. 303 - # 2. If you’re happy with the new attachment that got generated, then delete your markdown file by using the arrow keys to navigate the list of attachments and detaching the original text (pressing Shift and D with the default key bindings). 304 - # 3. Press send! 305 262 macro compose m \ 306 263 "<enter-command>set pipe_decode<enter>\ 307 264 <pipe-message>pandoc -f gfm -t plain -o /tmp/msg.txt<enter>\ ··· 311 268 <attach-file>/tmp/msg.html<enter>\ 312 269 <tag-entry><previous-entry><tag-entry><group-alternatives>" \ 313 270 "Convert markdown to HTML5 and plaintext alternative content types" 314 - 315 - # more configs at https://raw.githubusercontent.com/LukeSmithxyz/mutt-wizard/1c5085d3f203fbd4eef8813e0915fd6e3c899570/share/mutt-wizard.muttrc 316 - # and: https://seniormars.github.io/posts/neomutt/#motivation 317 - #
+317
mutt/.config/mutt/muttrc_offlineimap
··· 1 + 2 + 3 + ### offline email ------------------------- 4 + set folder = "~/Documents/mutt/sspaeti.com/" 5 + alias me "Simon Späti" "simon@ssp.sh" 6 + set mbox_type = Maildir 7 + set ssl_starttls = yes 8 + set ssl_force_tls = yes 9 + # set bcc="sspaeti@hey.com" 10 + 11 + # Neomutt will actively add CR or LF after the exact characters. As I'm doing them myself, I set it to 0. 12 + # set wrap=0 13 + set text_flowed 14 + 15 + ### Direct ------------------------------- 16 + # set folder = "imaps://simu@sspaeti.com@imap.mail.hostpoint.ch:993" 17 + # set smtp_url = "smtp://simu@sspaeti.com@asmtp.mail.hostpoint.ch:587" 18 + 19 + # set smpt password with ENV variable 20 + # set smtp_pass = "$HOSTSPINT_SMTP_PASSWORD_SIMU" 21 + # set imap_pass = "password" 22 + source ~/.dotfiles/zsh/.secret.muttrc 23 + 24 + set realname = "Simon Späti" 25 + set from = "simon@ssp.sh" 26 + # accounts in `~/msmtprc` 27 + set sendmail = "msmtp -a simon@sspaeti.com" 28 + # send each mail bcc to hey email in order to have the full picture there too 29 + send-hook . "my_hdr Bcc: sspaeti@hey.com" 30 + 31 + #Create Macros for Switching Accounts: 32 + macro compose <F1> "<enter-command>set sendmail='msmtp -a simon@ssp.sh'<enter><enter-command>set from='simon@ssp.sh'<enter>" 33 + macro compose <F2> "<enter-command>set sendmail='msmtp -a simon@sspaeti.com'<enter><enter-command>set from='simu@sspaeti.com'<enter>" 34 + macro compose <F3> "<enter-command>set sendmail='msmtp -a simu@sspaeti.com'<enter><enter-command>set from='simon@ssp.sh'<enter>" 35 + 36 + macro index <F1> ":set from='simon@ssp.sh'\n:set sendmail='mssmtp -a simon@ssp.sh'\n" 37 + macro index <F2> ":set from='simon@sspaeti.com'\n:set sendmail='msmtp -a simon@sspaeti.com'\n" 38 + macro index <F3> ":set from='simu@sspaeti.com'\n:set sendmail='msmtp -a simu@sspaeti.com'\n" 39 + 40 + set spoolfile = "+INBOX" 41 + set record = "+Sent" 42 + set trash = "+Trash" 43 + set postponed = "+Drafts" 44 + 45 + # Ensure TLS is enforced 46 + set ssl_starttls = yes 47 + set ssl_force_tls = yes 48 + 49 + mailboxes =INBOX =ToScreen =ScreenedOut =Waiting =Scheduled =Someday =Sent =Trash =Drafts =Junk =Archive =Others =Feed =PaperTrail =Spam" 50 + 51 + 52 + 53 + # macro compose <F4> "<enter-command>set sendmail='/usr/bin/msmtp -a gmail.com'<enter><enter-command>set from='simon.spaeti@gmail.com'<enter>" 54 + 55 + # SCREENER 56 + # 57 + ## Step 3: Decision Making Macros 58 + 59 + # Screen In and move to Inbox 60 + # 1. Takes the current message and sends it through a pipeline for processing. 61 + # 2. Uses awk to extract the last field (email address) from the line that starts with From: . The $NF is a special awk variable that represents the last field in a record. 62 + # 3. Removes angle brackets from around the email address, which are commonly used in email headers. 63 + # 4. Appends the email address to the screened_in.txt file. 64 + # 5. Saves the message to the Inbox after the macro executes. 65 + #works better with MIME types. done with formail 66 + macro index,pager I "<pipe-message>formail -zx From: | awk '/@/ {print \$NF}' | tr -d '<>' | grep -Eo '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}' | xargs -I {} echo {} >> ~/.config/mutt/screened_in.txt<enter><save-message>~/Documents/mutt/sspaeti.com/INBOX<enter>y" "Screen in this sender" 67 + 68 + # this does: 69 + # 1. Appends the email address to the screened_out.txt file. 70 + # 2. Saves the message to a folder named ScreenedOut after execution. 71 + # macro index,pager O "<pipe-message>awk '/^From: / {print \$NF}' | tr -d '<>' | xargs -I {} echo {} >> ~/.config/mutt/screened_out.txt<enter><save-message>~/Documents/mutt/sspaeti.com/ScreenedOut<enter>y" "Screen out this sender" 72 + macro index,pager O "<pipe-message>formail -zx From: | grep -Eo '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}' | xargs -I {} echo {} >> ~/.config/mutt/screened_out.txt<enter><save-message>~/Documents/mutt/sspaeti.com/ScreenedOut<enter>y" "Screen out this sender" 73 + 74 + # add to Feed list 75 + # macro index,pager F "<pipe-message>awk -F'[<>]' '/^From: / {print \$2}' | tr -d '<>' | xargs -I {} echo {} >> ~/.config/mutt/feed.txt<enter><save-message>~/Documents/mutt/sspaeti.com/Feed<enter>y" "Add sender to Feed" 76 + macro index,pager F "<pipe-message>formail -zx From: | grep -Eo '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}' | xargs -I {} echo {} >> ~/.config/mutt/feed.txt<enter><save-message>~/Documents/mutt/sspaeti.com/Feed<enter>y" "Add sender to Feed" 77 + 78 + 79 + # add to papertrail list 80 + # macro index,pager P "<pipe-message>awk '/^From: / {print \$NF}' | tr -d '<>' | xargs -I {} echo {} >> ~/.config/mutt/papertrail.txt<enter><save-message>~/Documents/mutt/sspaeti.com/PaperTrail<enter>y" "Add sender to PaperTrail" 81 + macro index,pager P "<pipe-message>formail -zx From: | grep -Eo '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}' | xargs -I {} echo {} >> ~/.config/mutt/papertrail.txt<enter><save-message>~/Documents/mutt/sspaeti.com/PaperTrail<enter>y" "Add sender to PaperTrail" 82 + 83 + 84 + # ## old / archive 85 + # macro index,pager I "<pipe-message>awk '/^From: / {print \$NF}' | tr -d '<>' | xargs -I {} echo {} >> ~/.config/mutt/screened_in.txt<enter><save-message>~/Documents/mutt/sspaeti.com/INBOX<enter>y" "Screen in this sender" 86 + # macro index,pager O "<pipe-message>awk -F'[<>]' '/^From: / {print \$2}' | tr -d '<>' | xargs -I {} echo {} >> ~/.config/mutt/screened_out.txt<enter><save-message>~/Documents/mutt/sspaeti.com/ScreenedOut<enter>y" "Screen out this sender" 87 + # macro index,pager F "<pipe-message>awk '/^From: / {print \$NF}' | tr -d '<>' | xargs -I {} echo {} >> ~/.config/mutt/feed.txt<enter><save-message>~/Documents/mutt/sspaeti.com/Feed<enter>y" "Add sender to Feed" 88 + # macro index,pager F "<pipe-message>awk '/^From: / { match(\$0, /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}/, arr); if(arr[0] != \"\") print arr[0] }' | tr -d '<>' | xargs -I {} echo {} >> ~/.config/mutt/feed.txt<enter><save-message>~/Documents/mutt/sspaeti.com/Feed<enter>y" "Add sender to Feed" 89 + # macro index,pager F "<pipe-message>echo %{from}<enter> | ./extract_email.sh | xargs -I {} echo {} >> ~/.config/mutt/feed.txt<enter><save-message>~/Documents/mutt/sspaeti.com/Feed<enter>y" "Add sender to Feed" 90 + # macro index,pager P "<pipe-message>awk -F'[<>]' '/^From: / {print \$2}' | tr -d '<>' | xargs -I {} echo {} >> ~/.config/mutt/papertrail.txt<enter><save-message>~/Documents/mutt/sspaeti.com/PaperTrail<enter>y" "Add sender to PaperTrail" 91 + 92 + ## Step 6: Updating Lists and Filters 93 + set my_screen_update_macro="<shell-escape>~/.config/mutt/update_screen_lists.sh<enter>" 94 + # macro index F5 "<shell-escape>~/.config/mutt/update_screen_lists.sh<enter>" 95 + 96 + 97 + # Where to put the stuff 98 + set header_cache = "~/.cache/mutt/headers" 99 + set message_cachedir = "~/.cache/mutt/bodies" 100 + set certificate_file = "~/.cache/mutt/certificates" 101 + #unset record 102 + 103 + set signature = "~/.config/mutt/signature" 104 + 105 + # link to mailcap file 106 + set mailcap_path = "~/.config/mutt/mailcap" 107 + # open attachments with mailcap with <return> 108 + bind attach <return> view-mailcap 109 + # save attachments to a folder 110 + macro attach s '<save-entry> <bol>~/Documents/attachments/<eol>' 'save attachment' 111 + auto_view text/html # automatically show html (mailcap uses lynx) 112 + 113 + #urlscan: open urls 114 + macro index,pager \cb "<pipe-message> urlscan<Enter>" "call urlscan to extract URLs out of a message" 115 + macro attach,compose \cb "<pipe-entry> urlscan<Enter>" "call urlscan to extract URLs out of a message" 116 + # macro pager \cb "|urlview\n" 117 + 118 + # query 119 + set query_command="/opt/homebrew/bin/lbdbq '%s'" 120 + bind editor <Tab> complete-query 121 + 122 + source ~/.config/mutt/color.muttrc 123 + 124 + bind index,pager i noop 125 + bind index,pager g noop 126 + bind index \Cf noop 127 + bind index,pager M noop 128 + bind index,pager C noop 129 + 130 + # General rebindings 131 + # set editor = "nvim" 132 + set editor="nvim -c 'setlocal filetype=markdown'" 133 + # for proper quoting 134 + set indent_string="> " 135 + 136 + 137 + bind index gg first-entry 138 + bind index j next-entry 139 + bind index k previous-entry 140 + bind attach <return> view-mailcap 141 + bind attach l view-mailcap 142 + bind editor <space> noop 143 + bind index G last-entry 144 + bind pager,attach h exit 145 + bind pager j next-line 146 + bind pager k previous-line 147 + bind pager l view-attachments 148 + 149 + 150 + #Vim navigation 151 + # Changed bindings for scrolling and deleting 152 + bind index,pager d noop 153 + bind index,pager,browser \Cd half-down 154 + bind index,pager,browser \Cu half-up 155 + bind index,pager d half-down 156 + bind index,pager u half-up 157 + bind index D delete-message 158 + 159 + # Global search macro (excluding ScreenedOut folder) 160 + macro index \Cf "<limit>~B " "search in all folders" 161 + # appendix to add: <search term> & !~f ScreenedOut 162 + 163 + # Unbind ESC+q from sort 164 + unbind index,pager \eq 165 + 166 + # bind index U undelete-message 167 + # bind index L limit 168 + bind index h noop 169 + bind index l display-message 170 + bind index,query <space> tag-entry 171 + #bind browser h goto-parent 172 + macro browser h '<change-dir><kill-line>..<enter>' "Go to parent folder" 173 + bind index,pager H view-raw-message 174 + bind browser l select-entry 175 + bind browser gg top-page 176 + bind browser G bottom-page 177 + bind pager gg top 178 + bind pager G bottom 179 + #sync & screener 180 + # macro index,pager S "<shell-escape>offlineimap -a sspaeti.com<enter><sync-mailbox><shell-escape>~/.config/mutt/initial_screening.sh >> ~/.config/mutt/logs/screening.log 2>&1<enter><sync-mailbox>" 181 + # both are seperate: 182 + macro index,pager S "<shell-escape>offlineimap -a sspaeti.com<enter><sync-mailbox>" 183 + # bind index,pager S sync-mailbox 184 + macro index,pager A "<shell-escape>~/.config/mutt/initial_screening.sh >> ~/.config/mutt/logs/screening.log 2>&1<enter><sync-mailbox>" 185 + 186 + 187 + # reomve selection 188 + # macro index U "T.t<enter>" 189 + # macro index U "<tag-pattern>.<enter>;<tag-toggle><enter>" 190 + macro index U "<tag-pattern>.<enter>;t<enter>" 191 + 192 + 193 + 194 + 195 + 196 + bind index,pager R group-reply 197 + bind index \031 previous-undeleted # Mouse wheel 198 + bind index \005 next-undeleted # Mouse wheel 199 + bind pager \031 previous-line # Mouse wheel 200 + bind pager \005 next-line # Mouse wheel 201 + bind editor <Tab> complete-query 202 + 203 + 204 + ## Move, copy and go to folders mappings 205 + macro index,pager gi "<change-folder>=INBOX<enter>" "go to INBOX" 206 + macro index,pager Mi ";<save-message>=INBOX<enter>y" "move mail to INBOX" 207 + 208 + macro index,pager gd "<change-folder>=Drafts<enter>" "go to drafts" 209 + macro index,pager Md ";<save-message>=Drafts<enter>y" "move mail to drafts" 210 + 211 + macro index,pager gj "<change-folder>=Junk<enter>" "go to junk" 212 + macro index,pager Mj ";<save-message>=Junk<enter>y" "move mail to junk" 213 + 214 + macro index,pager gt "<change-folder>=Trash<enter>" "go to trash" 215 + macro index,pager Mt ";<save-message>=Trash<enter>y" "move mail to trash" 216 + 217 + macro index,pager gs "<change-folder>=Sent<enter>" "go to sent" 218 + 219 + macro index,pager gm "<change-folder>=Someday<enter>" "go to Someday" 220 + macro index,pager Mm ";<save-message>=Someday<enter>" "move mail to Someday" 221 + 222 + macro index,pager ga "<change-folder>=Archive<enter>" "go to archive" 223 + macro index,pager Ma ";<save-message>=Archive<enter>y" "move mail to archive" 224 + 225 + macro index,pager gw "<change-folder>=Waiting<enter>" "go to waiting" 226 + macro index,pager Mw ";<save-message>=Waiting<enter>y" "move mail to waiting" 227 + 228 + macro index,pager gk "<change-folder>=ToScreen<enter>" "go to screener" 229 + 230 + macro index,pager gf "<change-folder>=Feed<enter>" "go to Feed" 231 + macro index,pager Mf ";<save-message>=Feed<enter>y" "move mail to Feed" 232 + 233 + macro index,pager gp "<change-folder>=PaperTrail<enter>" "go to PaperTrail" 234 + macro index,pager Mp ";<save-message>=PaperTrail<enter>y" "move mail to PaperTrail" 235 + 236 + macro index,pager go "<change-folder>=ScreenedOut<enter>" "go to screened out" 237 + macro index,pager Mo ";<save-message>=ScreenedOut<enter>y" "move mail to screened out" 238 + 239 + macro index,pager gl "<show-log-messages><enter>" "go to log messages" 240 + 241 + # Sidebar mappings 242 + set sidebar_visible = yes 243 + set sidebar_on_right = yes 244 + set sidebar_width = 20 245 + set sidebar_short_path = yes 246 + set sidebar_next_new_wrap = yes 247 + set mail_check_stats 248 + # set sidebar_format = '%D%?F? [%F]?%* %?N?%N/? %?S?%S?' 249 + set sidebar_format = "%B %* [%?N?%N / ?%S]" 250 + bind index,pager \Ck sidebar-prev 251 + bind index,pager \Cj sidebar-next 252 + bind index,pager \Co sidebar-open 253 + bind index,pager \Cp sidebar-prev-new 254 + bind index,pager \Cn sidebar-next-new 255 + bind index,pager B sidebar-toggle-visible 256 + 257 + 258 + # general settings from seniormars 259 + set pager_index_lines = 10 260 + set pager_context = 3 # show 3 lines of context 261 + set pager_stop # stop at end of message 262 + set menu_scroll # scroll menu 263 + set tilde # use ~ to pad mutt 264 + set move=no # don't move messages when marking as read 265 + set mail_check = 30 # check for new mail every 30 seconds 266 + set imap_keepalive = 900 # 15 minutes 267 + set sleep_time = 0 # don't sleep when idle 268 + set wait_key = no # mutt won't ask "press key to continue" 269 + set envelope_from # which from? 270 + set edit_headers # show headers when composing 271 + set fast_reply # skip to compose when replying 272 + set askcc # ask for CC: 273 + set fcc_attach # save attachments with the body 274 + set forward_format = "Fwd: %s" # format of subject when forwarding 275 + set forward_decode # decode when forwarding 276 + set forward_quote # include message in forwards 277 + set mime_forward # forward attachments as part of body 278 + set attribution = "On %d, %n wrote:" # format of quoting header 279 + set reply_to # reply to Reply to: field 280 + set reverse_name # reply as whomever it was to 281 + set include # include message in replies 282 + set text_flowed=yes # correct indentation for plain text 283 + unset sig_dashes # no dashes before sig 284 + unset markers 285 + 286 + # Sort by newest conversation first. 287 + set charset = "utf-8" 288 + set uncollapse_jump 289 + set sort_re 290 + set sort = reverse-threads 291 + set sort_aux = last-date-received 292 + # How we reply and quote emails. 293 + set reply_regexp = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*" 294 + set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+" 295 + set send_charset = "utf-8:iso-8859-1:us-ascii" # send in utf-8 296 + 297 + #Convert to HTML when hitting `m` for composing email 298 + # from: https://tom.wemyss.net/posts/neomutt-markdown-email/#2-set-up-a-pandoc-template-for-html-emails 299 + # 300 + # how it works: 301 + # Before pressing ‘y’ to send the message: 302 + # 1. Press ‘m’ to run the macro. All being well, this will automatically create another inline attachment containing both the HTML and the plain text. 303 + # 2. If you’re happy with the new attachment that got generated, then delete your markdown file by using the arrow keys to navigate the list of attachments and detaching the original text (pressing Shift and D with the default key bindings). 304 + # 3. Press send! 305 + macro compose m \ 306 + "<enter-command>set pipe_decode<enter>\ 307 + <pipe-message>pandoc -f gfm -t plain -o /tmp/msg.txt<enter>\ 308 + <pipe-message>pandoc -s -f gfm --self-contained -o /tmp/msg.html --resource-path ~/.config/mutt/templates/ --template email.html<enter>\ 309 + <enter-command>unset pipe_decode<enter>\ 310 + <attach-file>/tmp/msg.txt<enter>\ 311 + <attach-file>/tmp/msg.html<enter>\ 312 + <tag-entry><previous-entry><tag-entry><group-alternatives>" \ 313 + "Convert markdown to HTML5 and plaintext alternative content types" 314 + 315 + # more configs at https://raw.githubusercontent.com/LukeSmithxyz/mutt-wizard/1c5085d3f203fbd4eef8813e0915fd6e3c899570/share/mutt-wizard.muttrc 316 + # and: https://seniormars.github.io/posts/neomutt/#motivation 317 + #
+332
mutt/.config/mutt/notmuch/README.md
··· 1 + # Notmuch Email Screening Setup 2 + 3 + This directory contains the configuration and scripts for using **notmuch** with Neomutt for tag-based email management instead of folder-based organization. 4 + 5 + ## Overview 6 + 7 + Instead of moving emails between folders (INBOX, ScreenedOut, Feed, etc.), notmuch uses **tags** to organize emails: 8 + 9 + - `screened-in` - Approved senders (stay in inbox) 10 + - `screened-out` - Blocked senders (spam) 11 + - `feed` - Newsletters/feeds 12 + - `papertrail` - Receipts and papertrail items 13 + - `to-screen` - New emails needing manual review 14 + - Plus standard tags: `inbox`, `archive`, `spam`, `waiting`, `someday`, etc. 15 + 16 + ## Directory Structure 17 + 18 + ``` 19 + ~/.config/mutt/ 20 + ├── muttrc-notmuch # Main Neomutt config (use instead of muttrc) 21 + └── notmuch/ 22 + ├── README.md # This file 23 + ├── notmuch-config # Notmuch database configuration 24 + ├── notmuch_screening.sh # Tag-based screening script 25 + ├── mbsyncrc.example # Example mbsync config (recommended) 26 + └── sync/ 27 + ├── notmuch_sync.sh # Sync script for offlineimap + notmuch 28 + └── mbsync_notmuch_sync.sh # Sync script for mbsync + notmuch (recommended) 29 + ``` 30 + 31 + ## Required Files (Already in Top-Level Directory) 32 + 33 + These files from your existing setup are still needed: 34 + 35 + - `~/.config/mutt/screened_in.txt` - List of approved email addresses 36 + - `~/.config/mutt/screened_out.txt` - List of blocked email addresses 37 + - `~/.config/mutt/feed.txt` - List of newsletter/feed email addresses 38 + - `~/.config/mutt/papertrail.txt` - List of papertrail email addresses 39 + - `~/.config/mutt/color.muttrc` - Your color scheme 40 + - `~/.config/mutt/signature` - Email signature 41 + - `~/.config/mutt/mailcap` - MIME type handlers 42 + - `~/.dotfiles/zsh/.secret.muttrc` - Password/secrets file 43 + 44 + ## Installation & Setup 45 + 46 + ### Prerequisites 47 + 48 + Install required packages on Arch Linux: 49 + 50 + ```bash 51 + # For notmuch 52 + sudo pacman -S notmuch 53 + 54 + # For mbsync (recommended over offlineimap) 55 + sudo pacman -S isync 56 + 57 + # If keeping offlineimap 58 + sudo pacman -S offlineimap 59 + 60 + # Required utilities (likely already installed) 61 + sudo pacman -S formail grep sed coreutils 62 + ``` 63 + 64 + ### Option 1: Keep offlineimap (Easier Migration) 65 + 66 + 1. **Initialize notmuch database:** 67 + ```bash 68 + notmuch setup 69 + ``` 70 + - Database path: `/home/sspaeti/Documents/mutt/sspaeti.com` 71 + - Your name: `Simon Späti` 72 + - Primary email: `simon@ssp.sh` 73 + - Other emails: `simon@sspaeti.com;simu@sspaeti.com` 74 + 75 + 2. **Or use the pre-configured notmuch-config:** 76 + ```bash 77 + export NOTMUCH_CONFIG=~/.config/mutt/notmuch/notmuch-config 78 + notmuch new 79 + ``` 80 + 81 + 3. **Test the setup:** 82 + ```bash 83 + # Run initial screening 84 + ~/.config/mutt/notmuch/notmuch_screening.sh 85 + 86 + # Launch Neomutt with notmuch config 87 + neomutt -F ~/.config/mutt/muttrc-notmuch 88 + ``` 89 + 90 + 4. **Update your sync workflow:** 91 + - Use `~/.config/mutt/notmuch/sync/notmuch_sync.sh` instead of your old sync script 92 + - Or set up a cron job/systemd timer for automatic syncing 93 + 94 + ### Option 2: Upgrade to mbsync (Recommended) 95 + 96 + **Why mbsync?** 97 + - 3-5x faster than offlineimap 98 + - Actively maintained (offlineimap is dormant) 99 + - Better IMAP compliance 100 + - Lower resource usage 101 + 102 + **Setup Steps:** 103 + 104 + 1. **Configure mbsync:** 105 + ```bash 106 + cp ~/.config/mutt/notmuch/mbsyncrc.example ~/.mbsyncrc 107 + ``` 108 + 109 + 2. **Edit `~/.mbsyncrc`:** 110 + - Update the `PassCmd` line to match your password method 111 + - Verify folder names match your IMAP server 112 + 113 + 3. **Initial sync (takes a while):** 114 + ```bash 115 + mbsync -V sspaeti.com 116 + ``` 117 + 118 + 4. **Initialize notmuch:** 119 + ```bash 120 + export NOTMUCH_CONFIG=~/.config/mutt/notmuch/notmuch-config 121 + notmuch new 122 + ``` 123 + 124 + 5. **Run initial screening:** 125 + ```bash 126 + ~/.config/mutt/notmuch/notmuch_screening.sh 127 + ``` 128 + 129 + 6. **Launch Neomutt:** 130 + ```bash 131 + neomutt -F ~/.config/mutt/muttrc-notmuch 132 + ``` 133 + 134 + 7. **Update your workflow:** 135 + - Use `~/.config/mutt/notmuch/sync/mbsync_notmuch_sync.sh` for syncing 136 + 137 + ## Usage 138 + 139 + ### Starting Neomutt with Notmuch 140 + 141 + ```bash 142 + neomutt -F ~/.config/mutt/muttrc-notmuch 143 + ``` 144 + 145 + Or create an alias in your shell config: 146 + ```bash 147 + alias mutt="neomutt -F ~/.config/mutt/muttrc-notmuch" 148 + ``` 149 + 150 + ### Key Bindings (Same as Before!) 151 + 152 + **Screening macros:** 153 + - `I` - Screen in sender (add to approved list, tag as `screened-in`) 154 + - `O` - Screen out sender (add to blocked list, tag as `screened-out`) 155 + - `F` - Add sender to Feed list (tag as `feed`) 156 + - `P` - Add sender to PaperTrail list (tag as `papertrail`) 157 + 158 + **Navigation (using virtual mailboxes):** 159 + - `gi` - Go to INBOX 160 + - `gk` - Go to ToScreen (emails needing review) 161 + - `go` - Go to ScreenedOut 162 + - `gf` - Go to Feed 163 + - `gp` - Go to PaperTrail 164 + - `gw` - Go to Waiting 165 + - `gm` - Go to Someday 166 + - `ga` - Go to Archive 167 + - `gt` - Go to Trash 168 + - `gs` - Go to Sent 169 + 170 + **Tagging macros:** 171 + - `Mi` - Tag as inbox 172 + - `Mo` - Tag as screened-out 173 + - `Mf` - Tag as feed 174 + - `Mp` - Tag as papertrail 175 + - `Mw` - Tag as waiting 176 + - `Mm` - Tag as someday 177 + - `Ma` - Tag as archive 178 + - `Mt` - Tag as trash 179 + 180 + **Sync:** 181 + - `S` - Sync emails and run screening 182 + - `A` - Run screening only 183 + 184 + ### How Screening Works 185 + 186 + 1. **Automatic screening on sync:** 187 + - New emails are indexed by notmuch 188 + - Screening script checks sender against your lists 189 + - Tags are applied automatically 190 + 191 + 2. **Manual screening:** 192 + - Review emails in "ToScreen" mailbox (`gk`) 193 + - Press `I` to approve sender → moves to INBOX 194 + - Press `O` to block sender → tags as spam 195 + - Press `F` for feeds, `P` for papertrail 196 + 197 + 3. **List updates:** 198 + - When you approve/block a sender, their email is added to the respective .txt file 199 + - Previously received emails from that sender are retagged automatically 200 + 201 + ## Files Explained 202 + 203 + ### notmuch-config 204 + Notmuch database configuration. Defines: 205 + - Database path 206 + - Your email addresses 207 + - Default tags for new emails 208 + - Synchronization settings 209 + 210 + ### notmuch_screening.sh 211 + Core screening logic. This script: 212 + 1. Runs `notmuch new` to index new emails 213 + 2. Reads your screened lists (screened_in.txt, screened_out.txt, etc.) 214 + 3. Applies appropriate tags to emails based on sender 215 + 4. Retags emails in ToScreen if sender status changed 216 + 217 + **You should run this after each sync.** 218 + 219 + ### sync/notmuch_sync.sh 220 + Complete sync workflow for **offlineimap**: 221 + 1. Checks Wi-Fi connection 222 + 2. Runs offlineimap to fetch new emails 223 + 3. Runs notmuch screening 224 + 4. Syncs again to push any local changes 225 + 226 + ### sync/mbsync_notmuch_sync.sh 227 + Complete sync workflow for **mbsync**: 228 + 1. Checks Wi-Fi connection 229 + 2. Runs mbsync to fetch new emails 230 + 3. Runs notmuch screening 231 + 4. Syncs again to push any local changes 232 + 233 + ### mbsyncrc.example 234 + Template configuration for mbsync. Copy to `~/.mbsyncrc` and customize. 235 + 236 + ## Automation 237 + 238 + ### Systemd Timer (Recommended) 239 + 240 + Create `~/.config/systemd/user/mutt-sync.service`: 241 + ```ini 242 + [Unit] 243 + Description=Mutt Email Sync with Notmuch 244 + 245 + [Service] 246 + Type=oneshot 247 + ExecStart=/home/sspaeti/.config/mutt/notmuch/sync/mbsync_notmuch_sync.sh 248 + ``` 249 + 250 + Create `~/.config/systemd/user/mutt-sync.timer`: 251 + ```ini 252 + [Unit] 253 + Description=Sync emails every 10 minutes 254 + 255 + [Timer] 256 + OnBootSec=2min 257 + OnUnitActiveSec=10min 258 + 259 + [Install] 260 + WantedBy=timers.target 261 + ``` 262 + 263 + Enable and start: 264 + ```bash 265 + systemctl --user enable --now mutt-sync.timer 266 + ``` 267 + 268 + ### Cron Job Alternative 269 + 270 + Add to crontab (`crontab -e`): 271 + ```bash 272 + */10 * * * * /home/sspaeti/.config/mutt/notmuch/sync/mbsync_notmuch_sync.sh 273 + ``` 274 + 275 + ## Troubleshooting 276 + 277 + ### Notmuch can't find database 278 + ```bash 279 + export NOTMUCH_CONFIG=~/.config/mutt/notmuch/notmuch-config 280 + notmuch new 281 + ``` 282 + 283 + ### Tags not applying 284 + Check that your .txt files have proper formatting: 285 + ```bash 286 + # Remove trailing whitespace 287 + sed -i 's/[[:space:]]*$//' ~/.config/mutt/screened_in.txt 288 + ``` 289 + 290 + ### Virtual mailboxes empty 291 + Run notmuch manually to check: 292 + ```bash 293 + notmuch search tag:to-screen 294 + notmuch search tag:inbox 295 + ``` 296 + 297 + ### mbsync authentication fails 298 + Check password command in `~/.mbsyncrc`: 299 + ```bash 300 + # Test password retrieval 301 + grep HOSTPOINT_SMTP_PASSWORD_SIMU ~/.dotfiles/zsh/.secret.muttrc | cut -d'"' -f2 302 + ``` 303 + 304 + ## Migration from Folder-Based System 305 + 306 + Your existing folder-based setup will continue to work. To migrate: 307 + 308 + 1. **Keep both configs** - Use `muttrc` for old system, `muttrc-notmuch` for new 309 + 2. **Test thoroughly** with notmuch before fully switching 310 + 3. **Your .txt files work with both** - They're shared between systems 311 + 4. **No data loss** - Notmuch doesn't modify your maildir, just indexes it 312 + 313 + ## Advantages of Notmuch 314 + 315 + 1. **Multiple tags per email** - An email can be both "waiting" and "important" 316 + 2. **Faster search** - Full-text search across all email 317 + 3. **No file moving** - Tags are just metadata, files stay in place 318 + 4. **Better threading** - Notmuch excels at conversation threading 319 + 5. **Scriptable** - Easy to write custom tag rules 320 + 321 + ## Additional Resources 322 + 323 + - [Notmuch Documentation](https://notmuchmail.org/documentation/) 324 + - [Neomutt Notmuch Integration](https://neomutt.org/feature/notmuch) 325 + - [mbsync Documentation](https://isync.sourceforge.io/mbsync.html) 326 + 327 + ## Support 328 + 329 + If you encounter issues: 330 + 1. Check logs in `~/.config/mutt/logs/` 331 + 2. Run screening script manually to see errors 332 + 3. Test notmuch commands directly: `notmuch search`, `notmuch tag`, etc.
+135
mutt/.config/mutt/notmuch/mbsyncrc.example
··· 1 + # mbsync configuration for sspaeti.com 2 + # This is a template - customize and rename to ~/.mbsyncrc or ~/.config/mbsync/mbsyncrc 3 + 4 + # IMAP Account Configuration 5 + IMAPAccount sspaeti.com 6 + Host imap.mail.hostpoint.ch 7 + Port 993 8 + User simu@sspaeti.com 9 + # You can use PassCmd to get password from a command instead of storing it 10 + # PassCmd "pass show email/sspaeti.com" 11 + # Or use a password file: 12 + # PassCmd "cat ~/.dotfiles/zsh/.secret-mbsync" 13 + # Or set it directly (less secure): 14 + # Pass yourpasswordhere 15 + PassCmd "grep HOSTPOINT_SMTP_PASSWORD_SIMU ~/.dotfiles/zsh/.secret.muttrc | cut -d'\"' -f2" 16 + SSLType IMAPS 17 + CertificateFile /etc/ssl/certs/ca-certificates.crt 18 + # For Arch Linux specifically: 19 + # CertificateFile /etc/ssl/cert.pem 20 + 21 + # Remote IMAP Storage 22 + IMAPStore sspaeti.com-remote 23 + Account sspaeti.com 24 + 25 + # Local Maildir Storage 26 + MaildirStore sspaeti.com-local 27 + Path ~/Documents/mutt/sspaeti.com/ 28 + Inbox ~/Documents/mutt/sspaeti.com/INBOX 29 + SubFolders Verbatim 30 + 31 + # Channel Configuration - Sync everything 32 + Channel sspaeti.com-inbox 33 + Far :sspaeti.com-remote:INBOX 34 + Near :sspaeti.com-local:INBOX 35 + Create Both 36 + Expunge Both 37 + SyncState * 38 + 39 + Channel sspaeti.com-sent 40 + Far :sspaeti.com-remote:Sent 41 + Near :sspaeti.com-local:Sent 42 + Create Both 43 + Expunge Both 44 + SyncState * 45 + 46 + Channel sspaeti.com-drafts 47 + Far :sspaeti.com-remote:Drafts 48 + Near :sspaeti.com-local:Drafts 49 + Create Both 50 + Expunge Both 51 + SyncState * 52 + 53 + Channel sspaeti.com-trash 54 + Far :sspaeti.com-remote:Trash 55 + Near :sspaeti.com-local:Trash 56 + Create Both 57 + Expunge Both 58 + SyncState * 59 + 60 + Channel sspaeti.com-junk 61 + Far :sspaeti.com-remote:Junk 62 + Near :sspaeti.com-local:Junk 63 + Create Both 64 + Expunge Both 65 + SyncState * 66 + 67 + Channel sspaeti.com-archive 68 + Far :sspaeti.com-remote:Archive 69 + Near :sspaeti.com-local:Archive 70 + Create Both 71 + Expunge Both 72 + SyncState * 73 + 74 + # Add any other folders you have 75 + Channel sspaeti.com-toscreen 76 + Far :sspaeti.com-remote:ToScreen 77 + Near :sspaeti.com-local:ToScreen 78 + Create Both 79 + Expunge Both 80 + SyncState * 81 + 82 + Channel sspaeti.com-screenedout 83 + Far :sspaeti.com-remote:ScreenedOut 84 + Near :sspaeti.com-local:ScreenedOut 85 + Create Both 86 + Expunge Both 87 + SyncState * 88 + 89 + Channel sspaeti.com-waiting 90 + Far :sspaeti.com-remote:Waiting 91 + Near :sspaeti.com-local:Waiting 92 + Create Both 93 + Expunge Both 94 + SyncState * 95 + 96 + Channel sspaeti.com-someday 97 + Far :sspaeti.com-remote:Someday 98 + Near :sspaeti.com-local:Someday 99 + Create Both 100 + Expunge Both 101 + SyncState * 102 + 103 + Channel sspaeti.com-feed 104 + Far :sspaeti.com-remote:Feed 105 + Near :sspaeti.com-local:Feed 106 + Create Both 107 + Expunge Both 108 + SyncState * 109 + 110 + Channel sspaeti.com-papertrail 111 + Far :sspaeti.com-remote:PaperTrail 112 + Near :sspaeti.com-local:PaperTrail 113 + Create Both 114 + Expunge Both 115 + SyncState * 116 + 117 + # Group all channels together 118 + Group sspaeti.com 119 + Channel sspaeti.com-inbox 120 + Channel sspaeti.com-sent 121 + Channel sspaeti.com-drafts 122 + Channel sspaeti.com-trash 123 + Channel sspaeti.com-junk 124 + Channel sspaeti.com-archive 125 + Channel sspaeti.com-toscreen 126 + Channel sspaeti.com-screenedout 127 + Channel sspaeti.com-waiting 128 + Channel sspaeti.com-someday 129 + Channel sspaeti.com-feed 130 + Channel sspaeti.com-papertrail 131 + 132 + # Usage: 133 + # mbsync sspaeti.com # Sync all channels 134 + # mbsync sspaeti.com-inbox # Sync just inbox 135 + # mbsync -a # Sync all accounts
+28
mutt/.config/mutt/notmuch/notmuch-config
··· 1 + # Notmuch configuration for email screening system 2 + # This replaces folder-based organization with tag-based organization 3 + 4 + [database] 5 + path=/home/sspaeti/Documents/mutt/sspaeti.com 6 + 7 + [user] 8 + name=Simon Späti 9 + primary_email=simon@ssp.sh 10 + other_email=simon@sspaeti.com;simu@sspaeti.com 11 + 12 + [new] 13 + tags=unread;inbox;new 14 + ignore= 15 + 16 + [search] 17 + exclude_tags=deleted;spam; 18 + 19 + [maildir] 20 + synchronize_flags=true 21 + 22 + # Initial tagging rules 23 + [new] 24 + # Tag all new mail with 'new' and 'inbox' 25 + tags=new;inbox; 26 + 27 + # Auto-tagging based on folders (if needed for backward compatibility) 28 + # These will apply when notmuch indexes new mail
+94
mutt/.config/mutt/notmuch/notmuch_screening.sh
··· 1 + #!/bin/bash 2 + 3 + # Notmuch-based email screening script 4 + # Uses tags instead of moving emails between folders 5 + 6 + # Paths to screened lists 7 + screened_in="$HOME/.dotfiles/mutt/.lists/screened_in.txt" 8 + screened_out="$HOME/.dotfiles/mutt/.lists/screened_out.txt" 9 + feed_list="$HOME/.dotfiles/mutt/.lists/feed.txt" 10 + papertrail_list="$HOME/.dotfiles/mutt/.lists/papertrail.txt" 11 + 12 + # Create files if they don't exist 13 + touch "$screened_in" "$screened_out" "$feed_list" "$papertrail_list" 14 + 15 + # Trim trailing spaces 16 + if [[ "$OSTYPE" == "darwin"* ]]; then 17 + # macOS 18 + sed -i '' 's/[[:space:]]*$//' "$screened_in" 19 + sed -i '' 's/[[:space:]]*$//' "$screened_out" 20 + sed -i '' 's/[[:space:]]*$//' "$feed_list" 21 + sed -i '' 's/[[:space:]]*$//' "$papertrail_list" 22 + else 23 + # Linux 24 + sed -i 's/[[:space:]]*$//' "$screened_in" 25 + sed -i 's/[[:space:]]*$//' "$screened_out" 26 + sed -i 's/[[:space:]]*$//' "$feed_list" 27 + sed -i 's/[[:space:]]*$//' "$papertrail_list" 28 + fi 29 + 30 + # Set NOTMUCH_CONFIG to our custom location 31 + export NOTMUCH_CONFIG="$HOME/.config/mutt/notmuch/notmuch-config" 32 + 33 + printf "Starting notmuch screening at $(date '+%Y-%m-%d %H:%M:%S')...\n" 34 + 35 + # First, run notmuch new to index any new emails 36 + notmuch new 37 + 38 + # Tag emails based on screened lists 39 + # Process screened_out emails 40 + while IFS= read -r email; do 41 + [ -z "$email" ] && continue 42 + printf "Tagging emails from %s as screened-out...\n" "$email" 43 + notmuch tag +screened-out +spam -inbox -new -- from:"$email" tag:new 44 + done < "$screened_out" 45 + 46 + # Process feed emails 47 + while IFS= read -r email; do 48 + [ -z "$email" ] && continue 49 + printf "Tagging emails from %s as feed...\n" "$email" 50 + notmuch tag +feed -inbox -new -- from:"$email" tag:new 51 + done < "$feed_list" 52 + 53 + # Process papertrail emails 54 + while IFS= read -r email; do 55 + [ -z "$email" ] && continue 56 + printf "Tagging emails from %s as papertrail...\n" "$email" 57 + notmuch tag +papertrail -inbox -new -- from:"$email" tag:new 58 + done < "$papertrail_list" 59 + 60 + # Process screened_in emails (approved senders) 61 + while IFS= read -r email; do 62 + [ -z "$email" ] && continue 63 + printf "Tagging emails from %s as screened-in...\n" "$email" 64 + notmuch tag +screened-in -to-screen -new -- from:"$email" tag:new 65 + done < "$screened_in" 66 + 67 + # Tag remaining new emails that don't match any list as needing screening 68 + printf "Tagging remaining new emails as to-screen...\n" 69 + notmuch tag +to-screen -new -- tag:new and not tag:screened-in and not tag:screened-out and not tag:feed and not tag:papertrail 70 + 71 + # Move previously screened emails if sender status changed 72 + printf "Updating tags for emails in to-screen based on current lists...\n" 73 + 74 + # Check to-screen emails and retag if sender is now in a list 75 + for msg_id in $(notmuch search --output=messages tag:to-screen); do 76 + sender=$(notmuch show --format=json "$msg_id" | grep -o '"From":.*"' | head -1 | grep -Eo '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}') 77 + 78 + if grep -Fxq "$sender" "$screened_in"; then 79 + notmuch tag +screened-in +inbox -to-screen -- id:"$msg_id" 80 + printf "Moved %s back to inbox (screened-in)\n" "$msg_id" 81 + elif grep -Fxq "$sender" "$screened_out"; then 82 + notmuch tag +screened-out +spam -to-screen -inbox -- id:"$msg_id" 83 + printf "Tagged %s as screened-out\n" "$msg_id" 84 + elif grep -Fxq "$sender" "$feed_list"; then 85 + notmuch tag +feed -to-screen -inbox -- id:"$msg_id" 86 + printf "Tagged %s as feed\n" "$msg_id" 87 + elif grep -Fxq "$sender" "$papertrail_list"; then 88 + notmuch tag +papertrail -to-screen -inbox -- id:"$msg_id" 89 + printf "Tagged %s as papertrail\n" "$msg_id" 90 + fi 91 + done 92 + 93 + printf "Notmuch screening completed at $(date '+%Y-%m-%d %H:%M:%S')\n" 94 + printf -- "####################################\n"
+58
mutt/.config/mutt/notmuch/sync/mbsync_notmuch_sync.sh
··· 1 + #!/bin/bash 2 + 3 + # mbsync + Notmuch sync script for neomutt (Linux/Arch) 4 + # Syncs email with mbsync and applies notmuch screening tags 5 + 6 + # Log file path 7 + LOG_FILE=~/.config/mutt/logs/mbsync_notmuch_sync_status.log 8 + 9 + # Create log directory if it doesn't exist 10 + mkdir -p ~/.config/mutt/logs 11 + 12 + # Function to check if connected to Wi-Fi (Linux) 13 + check_wifi() { 14 + # Check if any wireless interface is connected 15 + if command -v nmcli &> /dev/null; then 16 + # Using NetworkManager 17 + if nmcli -t -f DEVICE,STATE device | grep -q "wifi:connected"; then 18 + return 0 # Connected to Wi-Fi 19 + fi 20 + elif command -v iwgetid &> /dev/null; then 21 + # Fallback to iwgetid 22 + if iwgetid -r &> /dev/null; then 23 + return 0 # Connected to Wi-Fi 24 + fi 25 + fi 26 + return 1 # Not connected to Wi-Fi 27 + } 28 + 29 + # Log start time 30 + echo "mbsync + Notmuch sync started at $(date)" >> "$LOG_FILE" 31 + 32 + # Check if connected to Wi-Fi 33 + if check_wifi; then 34 + # Run the first sync with mbsync 35 + echo "Running mbsync..." >> "$LOG_FILE" 36 + mbsync sspaeti.com 37 + 38 + # Wait for 2 seconds 39 + sleep 2 40 + 41 + # Run the notmuch screener 42 + echo "Running notmuch screening..." >> "$LOG_FILE" 43 + ~/.config/mutt/notmuch/notmuch_screening.sh >> ~/.config/mutt/logs/notmuch_screening.log 2>&1 44 + 45 + # Wait for 2 seconds 46 + sleep 2 47 + 48 + # Run the second sync (to sync any local changes back) 49 + echo "Running second mbsync..." >> "$LOG_FILE" 50 + mbsync sspaeti.com 51 + 52 + echo "mbsync + Notmuch sync completed successfully at $(date)" >> "$LOG_FILE" 53 + else 54 + echo "Not connected to Wi-Fi. Sync not performed at $(date)" >> "$LOG_FILE" 55 + fi 56 + 57 + # Keep only last 100 lines of log 58 + tail -100 "$LOG_FILE" > "$LOG_FILE.tmp" && mv "$LOG_FILE.tmp" "$LOG_FILE"
+58
mutt/.config/mutt/notmuch/sync/notmuch_sync.sh
··· 1 + #!/bin/bash 2 + 3 + # Notmuch-based sync script for neomutt (Linux/Arch) 4 + # Syncs email with offlineimap and applies notmuch screening tags 5 + 6 + # Log file path 7 + LOG_FILE=~/.config/mutt/logs/notmuch_sync_status.log 8 + 9 + # Create log directory if it doesn't exist 10 + mkdir -p ~/.config/mutt/logs 11 + 12 + # Function to check if connected to Wi-Fi (Linux) 13 + check_wifi() { 14 + # Check if any wireless interface is connected 15 + if command -v nmcli &> /dev/null; then 16 + # Using NetworkManager 17 + if nmcli -t -f DEVICE,STATE device | grep -q "wifi:connected"; then 18 + return 0 # Connected to Wi-Fi 19 + fi 20 + elif command -v iwgetid &> /dev/null; then 21 + # Fallback to iwgetid 22 + if iwgetid -r &> /dev/null; then 23 + return 0 # Connected to Wi-Fi 24 + fi 25 + fi 26 + return 1 # Not connected to Wi-Fi 27 + } 28 + 29 + # Log start time 30 + echo "Notmuch sync started at $(date)" >> "$LOG_FILE" 31 + 32 + # Check if connected to Wi-Fi 33 + if check_wifi; then 34 + # Run the first sync with offlineimap 35 + echo "Running offlineimap..." >> "$LOG_FILE" 36 + offlineimap -a sspaeti.com 37 + 38 + # Wait for 2 seconds 39 + sleep 2 40 + 41 + # Run the notmuch screener 42 + echo "Running notmuch screening..." >> "$LOG_FILE" 43 + ~/.config/mutt/notmuch/notmuch_screening.sh >> ~/.config/mutt/logs/notmuch_screening.log 2>&1 44 + 45 + # Wait for 2 seconds 46 + sleep 2 47 + 48 + # Run the second sync (to sync any local changes back) 49 + echo "Running second offlineimap sync..." >> "$LOG_FILE" 50 + offlineimap -a sspaeti.com 51 + 52 + echo "Notmuch sync completed successfully at $(date)" >> "$LOG_FILE" 53 + else 54 + echo "Not connected to Wi-Fi. Sync not performed at $(date)" >> "$LOG_FILE" 55 + fi 56 + 57 + # Keep only last 100 lines of log 58 + tail -100 "$LOG_FILE" > "$LOG_FILE.tmp" && mv "$LOG_FILE.tmp" "$LOG_FILE"
+134
mutt/.mbsyncrc
··· 1 + # mbsync configuration for sspaeti.com 2 + # This is a template - customize and rename to ~/.mbsyncrc or ~/.config/mbsync/mbsyncrc 3 + 4 + # IMAP Account Configuration 5 + IMAPAccount sspaeti.com 6 + Host imap.mail.hostpoint.ch 7 + Port 993 8 + User simu@sspaeti.com 9 + # You can use PassCmd to get password from a command instead of storing it 10 + # PassCmd "pass show email/sspaeti.com" 11 + # Or use a password file: 12 + # PassCmd "cat ~/.dotfiles/zsh/.secret-mbsync" 13 + # Or set it directly (less secure): 14 + # Pass yourpasswordhere 15 + PassCmd "grep imap_pass ~/.dotfiles/zsh/.secret.muttrc | cut -d'\"' -f2" 16 + TLSType IMAPS 17 + # For Arch Linux: 18 + CertificateFile /etc/ssl/cert.pem 19 + 20 + # Remote IMAP Storage 21 + IMAPStore sspaeti.com-remote 22 + Account sspaeti.com 23 + 24 + # Local Maildir Storage 25 + MaildirStore sspaeti.com-local 26 + Path ~/Documents/mutt/sspaeti.com/ 27 + Inbox ~/Documents/mutt/sspaeti.com/INBOX 28 + SubFolders Verbatim 29 + 30 + # Channel Configuration - Sync everything 31 + Channel sspaeti.com-inbox 32 + Far :sspaeti.com-remote:INBOX 33 + Near :sspaeti.com-local:INBOX 34 + Create Both 35 + Expunge Both 36 + SyncState * 37 + 38 + Channel sspaeti.com-sent 39 + Far :sspaeti.com-remote:Sent 40 + Near :sspaeti.com-local:Sent 41 + Create Both 42 + Expunge Both 43 + SyncState * 44 + 45 + Channel sspaeti.com-drafts 46 + Far :sspaeti.com-remote:Drafts 47 + Near :sspaeti.com-local:Drafts 48 + Create Both 49 + Expunge Both 50 + SyncState * 51 + 52 + Channel sspaeti.com-trash 53 + Far :sspaeti.com-remote:Trash 54 + Near :sspaeti.com-local:Trash 55 + Create Both 56 + Expunge Both 57 + SyncState * 58 + 59 + Channel sspaeti.com-junk 60 + Far :sspaeti.com-remote:Junk 61 + Near :sspaeti.com-local:Junk 62 + Create Both 63 + Expunge Both 64 + SyncState * 65 + 66 + Channel sspaeti.com-archive 67 + Far :sspaeti.com-remote:Archive 68 + Near :sspaeti.com-local:Archive 69 + Create Both 70 + Expunge Both 71 + SyncState * 72 + 73 + # Add any other folders you have 74 + Channel sspaeti.com-toscreen 75 + Far :sspaeti.com-remote:ToScreen 76 + Near :sspaeti.com-local:ToScreen 77 + Create Both 78 + Expunge Both 79 + SyncState * 80 + 81 + Channel sspaeti.com-screenedout 82 + Far :sspaeti.com-remote:ScreenedOut 83 + Near :sspaeti.com-local:ScreenedOut 84 + Create Both 85 + Expunge Both 86 + SyncState * 87 + 88 + Channel sspaeti.com-waiting 89 + Far :sspaeti.com-remote:Waiting 90 + Near :sspaeti.com-local:Waiting 91 + Create Both 92 + Expunge Both 93 + SyncState * 94 + 95 + Channel sspaeti.com-someday 96 + Far :sspaeti.com-remote:Someday 97 + Near :sspaeti.com-local:Someday 98 + Create Both 99 + Expunge Both 100 + SyncState * 101 + 102 + Channel sspaeti.com-feed 103 + Far :sspaeti.com-remote:Feed 104 + Near :sspaeti.com-local:Feed 105 + Create Both 106 + Expunge Both 107 + SyncState * 108 + 109 + Channel sspaeti.com-papertrail 110 + Far :sspaeti.com-remote:PaperTrail 111 + Near :sspaeti.com-local:PaperTrail 112 + Create Both 113 + Expunge Both 114 + SyncState * 115 + 116 + # Group all channels together 117 + Group sspaeti.com 118 + Channel sspaeti.com-inbox 119 + Channel sspaeti.com-sent 120 + Channel sspaeti.com-drafts 121 + Channel sspaeti.com-trash 122 + Channel sspaeti.com-junk 123 + Channel sspaeti.com-archive 124 + Channel sspaeti.com-toscreen 125 + Channel sspaeti.com-screenedout 126 + Channel sspaeti.com-waiting 127 + Channel sspaeti.com-someday 128 + Channel sspaeti.com-feed 129 + Channel sspaeti.com-papertrail 130 + 131 + # Usage: 132 + # mbsync sspaeti.com # Sync all channels 133 + # mbsync sspaeti.com-inbox # Sync just inbox 134 + # mbsync -a # Sync all accounts