···11-.PHONY: start logs help
11+.PHONY: loop logs help notmuch-loop notmuch-sync sync notmuch-logs notmuch-screen notmuch-init
22+33+.DEFAULT_GOAL := notmuch-loop
44+55+# Notmuch mail sync loop with mbsync (default)
66+notmuch-loop:
77+ @echo "Starting notmuch mail sync loop (10 minute intervals)..."
88+ @echo "Press Ctrl+C to stop"
99+ @while true; do \
1010+ ~/.config/mutt/notmuch/sync/mbsync_notmuch_sync.sh; \
1111+ echo "Sleeping for 10 minutes..."; \
1212+ sleep 600; \
1313+ done
1414+1515+# Run complete sync once (mbsync → notmuch index → screening → mbsync)
1616+notmuch-sync:
1717+ ~/.config/mutt/notmuch/sync/mbsync_notmuch_sync.sh
1818+1919+# Alias for notmuch-sync
2020+sync: notmuch-sync
2121+2222+# Show notmuch sync logs
2323+notmuch-logs:
2424+ tail -f ~/.config/mutt/logs/mbsync_notmuch_sync_status.log
2525+2626+# Show notmuch screening logs
2727+notmuch-screen-logs:
2828+ tail -f ~/.config/mutt/logs/notmuch_screening.log
2929+3030+# Run notmuch screening manually
3131+notmuch-screen:
3232+ ~/.config/mutt/notmuch/notmuch_screening.sh
3333+3434+# Initialize notmuch database
3535+notmuch-init:
3636+ @echo "Initializing notmuch database..."
3737+ @echo "Database path: /home/sspaeti/Documents/mutt/sspaeti.com"
3838+ NOTMUCH_CONFIG=~/.config/mutt/notmuch/notmuch-config notmuch new
23933-.DEFAULT_GOAL := loop
4040+#count emails
4141+count-emails:
4242+ find ~/Documents/mutt/sspaeti.com -type f | wc -l
44355-# Start mail sync
4444+# Legacy aliases (folder-based system)
645loop:
746 ~/.config/mutt/launchctl/mail_sync_watch.sh --loop
84799-# Show logs
1048logs:
1149 tail -f ~/.config/mutt/logs/mail_sync.log
12501351# Show help
1452help:
1553 @echo "Mail Sync Makefile commands:"
1616- @echo " make start - Start mail sync loop"
1717- @echo " make logs - Show mail sync logs"
1854 @echo ""
1919- @echo "Note: Use Ctrl+C to stop the sync"
5555+ @echo "=== Quick Commands ==="
5656+ @echo " make sync - Sync everything once (fetch → screen → sync back)"
5757+ @echo " make - Start continuous sync loop (same as notmuch-loop)"
5858+ @echo ""
5959+ @echo "=== Notmuch (tag-based system - DEFAULT) ==="
6060+ @echo " make notmuch-loop - Start notmuch sync loop (10 min intervals)"
6161+ @echo " make notmuch-sync - Run complete sync once (same as 'make sync')"
6262+ @echo " make notmuch-screen - Run notmuch screening manually"
6363+ @echo " make notmuch-init - Initialize/reindex notmuch database"
6464+ @echo ""
6565+ @echo "=== Logs ==="
6666+ @echo " make notmuch-logs - Show notmuch sync logs"
6767+ @echo " make notmuch-screen-logs - Show screening logs"
6868+ @echo " make count-emails - Count total emails locally"
6969+ @echo ""
7070+ @echo "=== Legacy (folder-based system) ==="
7171+ @echo " make loop - Start old mail sync loop"
7272+ @echo " make logs - Show old mail sync logs"
7373+ @echo ""
7474+ @echo "Note: Use Ctrl+C to stop any running sync loop"
+69-116
mutt/.config/mutt/muttrc
···1122+### Notmuch-based email configuration ###
33+# Source this instead of the regular muttrc to use tag-based email management
2435### offline email -------------------------
46set folder = "~/Documents/mutt/sspaeti.com/"
···1315set text_flowed
14161517### Direct -------------------------------
1616-# set folder = "imaps://simu@sspaeti.com@imap.mail.hostpoint.ch:993"
1717-# set smtp_url = "smtp://simu@sspaeti.com@asmtp.mail.hostpoint.ch:587"
1818-1919-# set smpt password with ENV variable
2020-# set smtp_pass = "$HOSTSPINT_SMTP_PASSWORD_SIMU"
2121-# set imap_pass = "password"
2218source ~/.dotfiles/zsh/.secret.muttrc
23192420set realname = "Simon Späti"
···3329macro compose <F2> "<enter-command>set sendmail='msmtp -a simon@sspaeti.com'<enter><enter-command>set from='simu@sspaeti.com'<enter>"
3430macro compose <F3> "<enter-command>set sendmail='msmtp -a simu@sspaeti.com'<enter><enter-command>set from='simon@ssp.sh'<enter>"
35313636-macro index <F1> ":set from='simon@ssp.sh'\n:set sendmail='mssmtp -a simon@ssp.sh'\n"
3737-macro index <F2> ":set from='simon@sspaeti.com'\n:set sendmail='msmtp -a simon@sspaeti.com'\n"
3838-macro index <F3> ":set from='simu@sspaeti.com'\n:set sendmail='msmtp -a simu@sspaeti.com'\n"
3232+macro index <F1> ":set from='simon@ssp.sh'\\n:set sendmail='mssmtp -a simon@ssp.sh'\\n"
3333+macro index <F2> ":set from='simon@sspaeti.com'\\n:set sendmail='msmtp -a simon@sspaeti.com'\\n"
3434+macro index <F3> ":set from='simu@sspaeti.com'\\n:set sendmail='msmtp -a simu@sspaeti.com'\\n"
39354036set spoolfile = "+INBOX"
4137set record = "+Sent"
···4642set ssl_starttls = yes
4743set ssl_force_tls = yes
48444949-mailboxes =INBOX =ToScreen =ScreenedOut =Waiting =Scheduled =Someday =Sent =Trash =Drafts =Junk =Archive =Others =Feed =PaperTrail =Spam"
4545+### NOTMUCH INTEGRATION ###
4646+set nm_default_url = "notmuch:///home/sspaeti/Documents/mutt/sspaeti.com"
4747+set nm_config_file = "~/.config/mutt/notmuch/notmuch-config"
4848+set virtual_spool_file = yes
50495050+# Virtual mailboxes using notmuch queries (tag-based)
5151+virtual-mailboxes \
5252+ "INBOX" "notmuch://?query=tag:inbox and tag:screened-in and not tag:archive" \
5353+ "ToScreen" "notmuch://?query=tag:to-screen" \
5454+ "ScreenedOut" "notmuch://?query=tag:screened-out" \
5555+ "Waiting" "notmuch://?query=tag:waiting" \
5656+ "Scheduled" "notmuch://?query=tag:scheduled" \
5757+ "Someday" "notmuch://?query=tag:someday" \
5858+ "Sent" "notmuch://?query=tag:sent" \
5959+ "Trash" "notmuch://?query=tag:deleted" \
6060+ "Drafts" "notmuch://?query=tag:draft" \
6161+ "Junk" "notmuch://?query=tag:spam or tag:junk" \
6262+ "Archive" "notmuch://?query=tag:archive" \
6363+ "Feed" "notmuch://?query=tag:feed" \
6464+ "PaperTrail" "notmuch://?query=tag:papertrail" \
6565+ "Unread" "notmuch://?query=tag:unread" \
6666+ "All Mail" "notmuch://?query=*"
51676868+# SCREENER - Notmuch version
6969+# Tag management macros instead of moving files
52705353-# macro compose <F4> "<enter-command>set sendmail='/usr/bin/msmtp -a gmail.com'<enter><enter-command>set from='simon.spaeti@gmail.com'<enter>"
7171+# Screen In - add screened-in tag and move to inbox
7272+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"
54735555-# SCREENER
5656-#
5757-## Step 3: Decision Making Macros
7474+# Screen Out - add screened-out tag
7575+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"
58765959-# Screen In and move to Inbox
6060-# 1. Takes the current message and sends it through a pipeline for processing.
6161-# 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.
6262-# 3. Removes angle brackets from around the email address, which are commonly used in email headers.
6363-# 4. Appends the email address to the screened_in.txt file.
6464-# 5. Saves the message to the Inbox after the macro executes.
6565-#works better with MIME types. done with formail
6666-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"
6767-6868-# this does:
6969-# 1. Appends the email address to the screened_out.txt file.
7070-# 2. Saves the message to a folder named ScreenedOut after execution.
7171-# 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"
7272-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"
7373-7474-# add to Feed list
7575-# 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"
7676-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"
7777-7878-7979-# add to papertrail list
8080-# 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"
8181-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"
7777+# Add to Feed list
7878+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"
82798080+# Add to PaperTrail list
8181+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"
83828484-# ## old / archive
8585-# 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"
8686-# 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"
8787-# 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"
8888-# 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"
8989-# 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"
9090-# 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"
9191-9292-## Step 6: Updating Lists and Filters
9393-set my_screen_update_macro="<shell-escape>~/.config/mutt/update_screen_lists.sh<enter>"
9494-# macro index F5 "<shell-escape>~/.config/mutt/update_screen_lists.sh<enter>"
9595-8383+# Sync and screen
8484+macro index,pager S "<shell-escape>~/.config/mutt/notmuch/sync/notmuch_sync.sh<enter>" "Sync with notmuch"
8585+macro index,pager A "<shell-escape>~/.config/mutt/notmuch/notmuch_screening.sh >> ~/.config/mutt/logs/notmuch_screening.log 2>&1<enter>" "Run notmuch screening"
96869787# Where to put the stuff
9888set header_cache = "~/.cache/mutt/headers"
9989set message_cachedir = "~/.cache/mutt/bodies"
10090set certificate_file = "~/.cache/mutt/certificates"
101101-#unset record
1029110392set signature = "~/.config/mutt/signature"
1049310594# link to mailcap file
10695set mailcap_path = "~/.config/mutt/mailcap"
10796# open attachments with mailcap with <return>
108108-bind attach <return> view-mailcap
9797+bind attach <return> view-mailcap
10998# save attachments to a folder
11099macro attach s '<save-entry> <bol>~/Documents/attachments/<eol>' 'save attachment'
111100auto_view text/html # automatically show html (mailcap uses lynx)
···113102#urlscan: open urls
114103macro index,pager \cb "<pipe-message> urlscan<Enter>" "call urlscan to extract URLs out of a message"
115104macro attach,compose \cb "<pipe-entry> urlscan<Enter>" "call urlscan to extract URLs out of a message"
116116-# macro pager \cb "|urlview\n"
117105118106# query
119107set query_command="/opt/homebrew/bin/lbdbq '%s'"
···128116bind index,pager C noop
129117130118# General rebindings
131131-# set editor = "nvim"
132119set editor="nvim -c 'setlocal filetype=markdown'"
133120# for proper quoting
134121set indent_string="> "
135122136136-137123bind index gg first-entry
138124bind index j next-entry
139125bind index k previous-entry
···146132bind pager k previous-line
147133bind pager l view-attachments
148134149149-150135#Vim navigation
151151-# Changed bindings for scrolling and deleting
152136bind index,pager d noop
153137bind index,pager,browser \Cd half-down
154138bind index,pager,browser \Cu half-up
···156140bind index,pager u half-up
157141bind index D delete-message
158142159159-# Global search macro (excluding ScreenedOut folder)
143143+# Global search macro
160144macro index \Cf "<limit>~B " "search in all folders"
161161-# appendix to add: <search term> & !~f ScreenedOut
162145163146# Unbind ESC+q from sort
164147unbind index,pager \eq
165148166166-# bind index U undelete-message
167167-# bind index L limit
168149bind index h noop
169150bind index l display-message
170151bind index,query <space> tag-entry
171171-#bind browser h goto-parent
172152macro browser h '<change-dir><kill-line>..<enter>' "Go to parent folder"
173153bind index,pager H view-raw-message
174154bind browser l select-entry
···176156bind browser G bottom-page
177157bind pager gg top
178158bind pager G bottom
179179-#sync & screener
180180-# 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>"
181181-# both are seperate:
182182-macro index,pager S "<shell-escape>offlineimap -a sspaeti.com<enter><sync-mailbox>"
183183-# bind index,pager S sync-mailbox
184184-macro index,pager A "<shell-escape>~/.config/mutt/initial_screening.sh >> ~/.config/mutt/logs/screening.log 2>&1<enter><sync-mailbox>"
185159186186-187187-# reomve selection
188188-# macro index U "T.t<enter>"
189189-# macro index U "<tag-pattern>.<enter>;<tag-toggle><enter>"
160160+# Remove selection
190161macro index U "<tag-pattern>.<enter>;t<enter>"
191162192192-193193-194194-195195-196163bind index,pager R group-reply
197164bind index \031 previous-undeleted # Mouse wheel
198165bind index \005 next-undeleted # Mouse wheel
···200167bind pager \005 next-line # Mouse wheel
201168bind editor <Tab> complete-query
202169170170+## Tag-based folder navigation (using notmuch virtual mailboxes)
171171+macro index,pager gi "<change-vfolder>INBOX<enter>" "go to INBOX"
172172+macro index,pager Mi "<modify-labels>+inbox +screened-in -to-screen -screened-out -feed -papertrail<enter>" "tag as inbox"
203173204204-## Move, copy and go to folders mappings
205205-macro index,pager gi "<change-folder>=INBOX<enter>" "go to INBOX"
206206-macro index,pager Mi ";<save-message>=INBOX<enter>y" "move mail to INBOX"
174174+macro index,pager gd "<change-vfolder>Drafts<enter>" "go to drafts"
175175+macro index,pager Md "<modify-labels>+draft<enter>" "tag as draft"
207176208208-macro index,pager gd "<change-folder>=Drafts<enter>" "go to drafts"
209209-macro index,pager Md ";<save-message>=Drafts<enter>y" "move mail to drafts"
177177+macro index,pager gj "<change-vfolder>Junk<enter>" "go to junk"
178178+macro index,pager Mj "<modify-labels>+junk +spam -inbox<enter>" "tag as junk"
210179211211-macro index,pager gj "<change-folder>=Junk<enter>" "go to junk"
212212-macro index,pager Mj ";<save-message>=Junk<enter>y" "move mail to junk"
180180+macro index,pager gt "<change-vfolder>Trash<enter>" "go to trash"
181181+macro index,pager Mt "<modify-labels>+deleted -inbox<enter>" "tag as trash"
213182214214-macro index,pager gt "<change-folder>=Trash<enter>" "go to trash"
215215-macro index,pager Mt ";<save-message>=Trash<enter>y" "move mail to trash"
183183+macro index,pager gs "<change-vfolder>Sent<enter>" "go to sent"
216184217217-macro index,pager gs "<change-folder>=Sent<enter>" "go to sent"
218218-219219-macro index,pager gm "<change-folder>=Someday<enter>" "go to Someday"
220220-macro index,pager Mm ";<save-message>=Someday<enter>" "move mail to Someday"
185185+macro index,pager gm "<change-vfolder>Someday<enter>" "go to Someday"
186186+macro index,pager Mm "<modify-labels>+someday -inbox<enter>" "tag as someday"
221187222222-macro index,pager ga "<change-folder>=Archive<enter>" "go to archive"
223223-macro index,pager Ma ";<save-message>=Archive<enter>y" "move mail to archive"
188188+macro index,pager ga "<change-vfolder>Archive<enter>" "go to archive"
189189+macro index,pager Ma "<modify-labels>+archive -inbox<enter>" "tag as archive"
224190225225-macro index,pager gw "<change-folder>=Waiting<enter>" "go to waiting"
226226-macro index,pager Mw ";<save-message>=Waiting<enter>y" "move mail to waiting"
191191+macro index,pager gw "<change-vfolder>Waiting<enter>" "go to waiting"
192192+macro index,pager Mw "<modify-labels>+waiting -inbox<enter>" "tag as waiting"
227193228228-macro index,pager gk "<change-folder>=ToScreen<enter>" "go to screener"
194194+macro index,pager gk "<change-vfolder>ToScreen<enter>" "go to screener"
229195230230-macro index,pager gf "<change-folder>=Feed<enter>" "go to Feed"
231231-macro index,pager Mf ";<save-message>=Feed<enter>y" "move mail to Feed"
196196+macro index,pager gf "<change-vfolder>Feed<enter>" "go to Feed"
197197+macro index,pager Mf "<modify-labels>+feed -inbox<enter>" "tag as feed"
232198233233-macro index,pager gp "<change-folder>=PaperTrail<enter>" "go to PaperTrail"
234234-macro index,pager Mp ";<save-message>=PaperTrail<enter>y" "move mail to PaperTrail"
199199+macro index,pager gp "<change-vfolder>PaperTrail<enter>" "go to PaperTrail"
200200+macro index,pager Mp "<modify-labels>+papertrail -inbox<enter>" "tag as papertrail"
235201236236-macro index,pager go "<change-folder>=ScreenedOut<enter>" "go to screened out"
237237-macro index,pager Mo ";<save-message>=ScreenedOut<enter>y" "move mail to screened out"
202202+macro index,pager go "<change-vfolder>ScreenedOut<enter>" "go to screened out"
203203+macro index,pager Mo "<modify-labels>+screened-out +spam -inbox<enter>" "tag as screened out"
238204239205macro index,pager gl "<show-log-messages><enter>" "go to log messages"
240206241207# Sidebar mappings
242208set sidebar_visible = yes
243209set sidebar_on_right = yes
244244-set sidebar_width = 20
210210+set sidebar_width = 30
245211set sidebar_short_path = yes
246212set sidebar_next_new_wrap = yes
247213set mail_check_stats
248248-# set sidebar_format = '%D%?F? [%F]?%* %?N?%N/? %?S?%S?'
249214set sidebar_format = "%B %* [%?N?%N / ?%S]"
250215bind index,pager \Ck sidebar-prev
251216bind index,pager \Cj sidebar-next
···253218bind index,pager \Cp sidebar-prev-new
254219bind index,pager \Cn sidebar-next-new
255220bind index,pager B sidebar-toggle-visible
256256-257221258222# general settings from seniormars
259259-set pager_index_lines = 10
223223+set pager_index_lines = 10
260224set pager_context = 3 # show 3 lines of context
261225set pager_stop # stop at end of message
262226set menu_scroll # scroll menu
···264228set move=no # don't move messages when marking as read
265229set mail_check = 30 # check for new mail every 30 seconds
266230set imap_keepalive = 900 # 15 minutes
267267-set sleep_time = 0 # don't sleep when idle
231231+set sleep_time = 0 # don't sleep when idle
268232set wait_key = no # mutt won't ask "press key to continue"
269233set envelope_from # which from?
270234set edit_headers # show headers when composing
···290254set sort = reverse-threads
291255set sort_aux = last-date-received
292256# How we reply and quote emails.
293293-set reply_regexp = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"
257257+set reply_regexp = "^(([Rr][Ee]?(\\[[0-9]+\\])?: *)?(\\[[^]]+\\] *)?)*"
294258set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
295259set send_charset = "utf-8:iso-8859-1:us-ascii" # send in utf-8
296260297261#Convert to HTML when hitting `m` for composing email
298298-# from: https://tom.wemyss.net/posts/neomutt-markdown-email/#2-set-up-a-pandoc-template-for-html-emails
299299-#
300300-# how it works:
301301-# Before pressing ‘y’ to send the message:
302302-# 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.
303303-# 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).
304304-# 3. Press send!
305262macro compose m \
306263"<enter-command>set pipe_decode<enter>\
307264<pipe-message>pandoc -f gfm -t plain -o /tmp/msg.txt<enter>\
···311268<attach-file>/tmp/msg.html<enter>\
312269<tag-entry><previous-entry><tag-entry><group-alternatives>" \
313270"Convert markdown to HTML5 and plaintext alternative content types"
314314-315315-# more configs at https://raw.githubusercontent.com/LukeSmithxyz/mutt-wizard/1c5085d3f203fbd4eef8813e0915fd6e3c899570/share/mutt-wizard.muttrc
316316-# and: https://seniormars.github.io/posts/neomutt/#motivation
317317-#
+317
mutt/.config/mutt/muttrc_offlineimap
···11+22+33+### offline email -------------------------
44+set folder = "~/Documents/mutt/sspaeti.com/"
55+alias me "Simon Späti" "simon@ssp.sh"
66+set mbox_type = Maildir
77+set ssl_starttls = yes
88+set ssl_force_tls = yes
99+# set bcc="sspaeti@hey.com"
1010+1111+# Neomutt will actively add CR or LF after the exact characters. As I'm doing them myself, I set it to 0.
1212+# set wrap=0
1313+set text_flowed
1414+1515+### Direct -------------------------------
1616+# set folder = "imaps://simu@sspaeti.com@imap.mail.hostpoint.ch:993"
1717+# set smtp_url = "smtp://simu@sspaeti.com@asmtp.mail.hostpoint.ch:587"
1818+1919+# set smpt password with ENV variable
2020+# set smtp_pass = "$HOSTSPINT_SMTP_PASSWORD_SIMU"
2121+# set imap_pass = "password"
2222+source ~/.dotfiles/zsh/.secret.muttrc
2323+2424+set realname = "Simon Späti"
2525+set from = "simon@ssp.sh"
2626+# accounts in `~/msmtprc`
2727+set sendmail = "msmtp -a simon@sspaeti.com"
2828+# send each mail bcc to hey email in order to have the full picture there too
2929+send-hook . "my_hdr Bcc: sspaeti@hey.com"
3030+3131+#Create Macros for Switching Accounts:
3232+macro compose <F1> "<enter-command>set sendmail='msmtp -a simon@ssp.sh'<enter><enter-command>set from='simon@ssp.sh'<enter>"
3333+macro compose <F2> "<enter-command>set sendmail='msmtp -a simon@sspaeti.com'<enter><enter-command>set from='simu@sspaeti.com'<enter>"
3434+macro compose <F3> "<enter-command>set sendmail='msmtp -a simu@sspaeti.com'<enter><enter-command>set from='simon@ssp.sh'<enter>"
3535+3636+macro index <F1> ":set from='simon@ssp.sh'\n:set sendmail='mssmtp -a simon@ssp.sh'\n"
3737+macro index <F2> ":set from='simon@sspaeti.com'\n:set sendmail='msmtp -a simon@sspaeti.com'\n"
3838+macro index <F3> ":set from='simu@sspaeti.com'\n:set sendmail='msmtp -a simu@sspaeti.com'\n"
3939+4040+set spoolfile = "+INBOX"
4141+set record = "+Sent"
4242+set trash = "+Trash"
4343+set postponed = "+Drafts"
4444+4545+# Ensure TLS is enforced
4646+set ssl_starttls = yes
4747+set ssl_force_tls = yes
4848+4949+mailboxes =INBOX =ToScreen =ScreenedOut =Waiting =Scheduled =Someday =Sent =Trash =Drafts =Junk =Archive =Others =Feed =PaperTrail =Spam"
5050+5151+5252+5353+# macro compose <F4> "<enter-command>set sendmail='/usr/bin/msmtp -a gmail.com'<enter><enter-command>set from='simon.spaeti@gmail.com'<enter>"
5454+5555+# SCREENER
5656+#
5757+## Step 3: Decision Making Macros
5858+5959+# Screen In and move to Inbox
6060+# 1. Takes the current message and sends it through a pipeline for processing.
6161+# 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.
6262+# 3. Removes angle brackets from around the email address, which are commonly used in email headers.
6363+# 4. Appends the email address to the screened_in.txt file.
6464+# 5. Saves the message to the Inbox after the macro executes.
6565+#works better with MIME types. done with formail
6666+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"
6767+6868+# this does:
6969+# 1. Appends the email address to the screened_out.txt file.
7070+# 2. Saves the message to a folder named ScreenedOut after execution.
7171+# 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"
7272+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"
7373+7474+# add to Feed list
7575+# 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"
7676+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"
7777+7878+7979+# add to papertrail list
8080+# 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"
8181+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"
8282+8383+8484+# ## old / archive
8585+# 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"
8686+# 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"
8787+# 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"
8888+# 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"
8989+# 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"
9090+# 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"
9191+9292+## Step 6: Updating Lists and Filters
9393+set my_screen_update_macro="<shell-escape>~/.config/mutt/update_screen_lists.sh<enter>"
9494+# macro index F5 "<shell-escape>~/.config/mutt/update_screen_lists.sh<enter>"
9595+9696+9797+# Where to put the stuff
9898+set header_cache = "~/.cache/mutt/headers"
9999+set message_cachedir = "~/.cache/mutt/bodies"
100100+set certificate_file = "~/.cache/mutt/certificates"
101101+#unset record
102102+103103+set signature = "~/.config/mutt/signature"
104104+105105+# link to mailcap file
106106+set mailcap_path = "~/.config/mutt/mailcap"
107107+# open attachments with mailcap with <return>
108108+bind attach <return> view-mailcap
109109+# save attachments to a folder
110110+macro attach s '<save-entry> <bol>~/Documents/attachments/<eol>' 'save attachment'
111111+auto_view text/html # automatically show html (mailcap uses lynx)
112112+113113+#urlscan: open urls
114114+macro index,pager \cb "<pipe-message> urlscan<Enter>" "call urlscan to extract URLs out of a message"
115115+macro attach,compose \cb "<pipe-entry> urlscan<Enter>" "call urlscan to extract URLs out of a message"
116116+# macro pager \cb "|urlview\n"
117117+118118+# query
119119+set query_command="/opt/homebrew/bin/lbdbq '%s'"
120120+bind editor <Tab> complete-query
121121+122122+source ~/.config/mutt/color.muttrc
123123+124124+bind index,pager i noop
125125+bind index,pager g noop
126126+bind index \Cf noop
127127+bind index,pager M noop
128128+bind index,pager C noop
129129+130130+# General rebindings
131131+# set editor = "nvim"
132132+set editor="nvim -c 'setlocal filetype=markdown'"
133133+# for proper quoting
134134+set indent_string="> "
135135+136136+137137+bind index gg first-entry
138138+bind index j next-entry
139139+bind index k previous-entry
140140+bind attach <return> view-mailcap
141141+bind attach l view-mailcap
142142+bind editor <space> noop
143143+bind index G last-entry
144144+bind pager,attach h exit
145145+bind pager j next-line
146146+bind pager k previous-line
147147+bind pager l view-attachments
148148+149149+150150+#Vim navigation
151151+# Changed bindings for scrolling and deleting
152152+bind index,pager d noop
153153+bind index,pager,browser \Cd half-down
154154+bind index,pager,browser \Cu half-up
155155+bind index,pager d half-down
156156+bind index,pager u half-up
157157+bind index D delete-message
158158+159159+# Global search macro (excluding ScreenedOut folder)
160160+macro index \Cf "<limit>~B " "search in all folders"
161161+# appendix to add: <search term> & !~f ScreenedOut
162162+163163+# Unbind ESC+q from sort
164164+unbind index,pager \eq
165165+166166+# bind index U undelete-message
167167+# bind index L limit
168168+bind index h noop
169169+bind index l display-message
170170+bind index,query <space> tag-entry
171171+#bind browser h goto-parent
172172+macro browser h '<change-dir><kill-line>..<enter>' "Go to parent folder"
173173+bind index,pager H view-raw-message
174174+bind browser l select-entry
175175+bind browser gg top-page
176176+bind browser G bottom-page
177177+bind pager gg top
178178+bind pager G bottom
179179+#sync & screener
180180+# 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>"
181181+# both are seperate:
182182+macro index,pager S "<shell-escape>offlineimap -a sspaeti.com<enter><sync-mailbox>"
183183+# bind index,pager S sync-mailbox
184184+macro index,pager A "<shell-escape>~/.config/mutt/initial_screening.sh >> ~/.config/mutt/logs/screening.log 2>&1<enter><sync-mailbox>"
185185+186186+187187+# reomve selection
188188+# macro index U "T.t<enter>"
189189+# macro index U "<tag-pattern>.<enter>;<tag-toggle><enter>"
190190+macro index U "<tag-pattern>.<enter>;t<enter>"
191191+192192+193193+194194+195195+196196+bind index,pager R group-reply
197197+bind index \031 previous-undeleted # Mouse wheel
198198+bind index \005 next-undeleted # Mouse wheel
199199+bind pager \031 previous-line # Mouse wheel
200200+bind pager \005 next-line # Mouse wheel
201201+bind editor <Tab> complete-query
202202+203203+204204+## Move, copy and go to folders mappings
205205+macro index,pager gi "<change-folder>=INBOX<enter>" "go to INBOX"
206206+macro index,pager Mi ";<save-message>=INBOX<enter>y" "move mail to INBOX"
207207+208208+macro index,pager gd "<change-folder>=Drafts<enter>" "go to drafts"
209209+macro index,pager Md ";<save-message>=Drafts<enter>y" "move mail to drafts"
210210+211211+macro index,pager gj "<change-folder>=Junk<enter>" "go to junk"
212212+macro index,pager Mj ";<save-message>=Junk<enter>y" "move mail to junk"
213213+214214+macro index,pager gt "<change-folder>=Trash<enter>" "go to trash"
215215+macro index,pager Mt ";<save-message>=Trash<enter>y" "move mail to trash"
216216+217217+macro index,pager gs "<change-folder>=Sent<enter>" "go to sent"
218218+219219+macro index,pager gm "<change-folder>=Someday<enter>" "go to Someday"
220220+macro index,pager Mm ";<save-message>=Someday<enter>" "move mail to Someday"
221221+222222+macro index,pager ga "<change-folder>=Archive<enter>" "go to archive"
223223+macro index,pager Ma ";<save-message>=Archive<enter>y" "move mail to archive"
224224+225225+macro index,pager gw "<change-folder>=Waiting<enter>" "go to waiting"
226226+macro index,pager Mw ";<save-message>=Waiting<enter>y" "move mail to waiting"
227227+228228+macro index,pager gk "<change-folder>=ToScreen<enter>" "go to screener"
229229+230230+macro index,pager gf "<change-folder>=Feed<enter>" "go to Feed"
231231+macro index,pager Mf ";<save-message>=Feed<enter>y" "move mail to Feed"
232232+233233+macro index,pager gp "<change-folder>=PaperTrail<enter>" "go to PaperTrail"
234234+macro index,pager Mp ";<save-message>=PaperTrail<enter>y" "move mail to PaperTrail"
235235+236236+macro index,pager go "<change-folder>=ScreenedOut<enter>" "go to screened out"
237237+macro index,pager Mo ";<save-message>=ScreenedOut<enter>y" "move mail to screened out"
238238+239239+macro index,pager gl "<show-log-messages><enter>" "go to log messages"
240240+241241+# Sidebar mappings
242242+set sidebar_visible = yes
243243+set sidebar_on_right = yes
244244+set sidebar_width = 20
245245+set sidebar_short_path = yes
246246+set sidebar_next_new_wrap = yes
247247+set mail_check_stats
248248+# set sidebar_format = '%D%?F? [%F]?%* %?N?%N/? %?S?%S?'
249249+set sidebar_format = "%B %* [%?N?%N / ?%S]"
250250+bind index,pager \Ck sidebar-prev
251251+bind index,pager \Cj sidebar-next
252252+bind index,pager \Co sidebar-open
253253+bind index,pager \Cp sidebar-prev-new
254254+bind index,pager \Cn sidebar-next-new
255255+bind index,pager B sidebar-toggle-visible
256256+257257+258258+# general settings from seniormars
259259+set pager_index_lines = 10
260260+set pager_context = 3 # show 3 lines of context
261261+set pager_stop # stop at end of message
262262+set menu_scroll # scroll menu
263263+set tilde # use ~ to pad mutt
264264+set move=no # don't move messages when marking as read
265265+set mail_check = 30 # check for new mail every 30 seconds
266266+set imap_keepalive = 900 # 15 minutes
267267+set sleep_time = 0 # don't sleep when idle
268268+set wait_key = no # mutt won't ask "press key to continue"
269269+set envelope_from # which from?
270270+set edit_headers # show headers when composing
271271+set fast_reply # skip to compose when replying
272272+set askcc # ask for CC:
273273+set fcc_attach # save attachments with the body
274274+set forward_format = "Fwd: %s" # format of subject when forwarding
275275+set forward_decode # decode when forwarding
276276+set forward_quote # include message in forwards
277277+set mime_forward # forward attachments as part of body
278278+set attribution = "On %d, %n wrote:" # format of quoting header
279279+set reply_to # reply to Reply to: field
280280+set reverse_name # reply as whomever it was to
281281+set include # include message in replies
282282+set text_flowed=yes # correct indentation for plain text
283283+unset sig_dashes # no dashes before sig
284284+unset markers
285285+286286+# Sort by newest conversation first.
287287+set charset = "utf-8"
288288+set uncollapse_jump
289289+set sort_re
290290+set sort = reverse-threads
291291+set sort_aux = last-date-received
292292+# How we reply and quote emails.
293293+set reply_regexp = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"
294294+set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
295295+set send_charset = "utf-8:iso-8859-1:us-ascii" # send in utf-8
296296+297297+#Convert to HTML when hitting `m` for composing email
298298+# from: https://tom.wemyss.net/posts/neomutt-markdown-email/#2-set-up-a-pandoc-template-for-html-emails
299299+#
300300+# how it works:
301301+# Before pressing ‘y’ to send the message:
302302+# 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.
303303+# 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).
304304+# 3. Press send!
305305+macro compose m \
306306+"<enter-command>set pipe_decode<enter>\
307307+<pipe-message>pandoc -f gfm -t plain -o /tmp/msg.txt<enter>\
308308+<pipe-message>pandoc -s -f gfm --self-contained -o /tmp/msg.html --resource-path ~/.config/mutt/templates/ --template email.html<enter>\
309309+<enter-command>unset pipe_decode<enter>\
310310+<attach-file>/tmp/msg.txt<enter>\
311311+<attach-file>/tmp/msg.html<enter>\
312312+<tag-entry><previous-entry><tag-entry><group-alternatives>" \
313313+"Convert markdown to HTML5 and plaintext alternative content types"
314314+315315+# more configs at https://raw.githubusercontent.com/LukeSmithxyz/mutt-wizard/1c5085d3f203fbd4eef8813e0915fd6e3c899570/share/mutt-wizard.muttrc
316316+# and: https://seniormars.github.io/posts/neomutt/#motivation
317317+#
+332
mutt/.config/mutt/notmuch/README.md
···11+# Notmuch Email Screening Setup
22+33+This directory contains the configuration and scripts for using **notmuch** with Neomutt for tag-based email management instead of folder-based organization.
44+55+## Overview
66+77+Instead of moving emails between folders (INBOX, ScreenedOut, Feed, etc.), notmuch uses **tags** to organize emails:
88+99+- `screened-in` - Approved senders (stay in inbox)
1010+- `screened-out` - Blocked senders (spam)
1111+- `feed` - Newsletters/feeds
1212+- `papertrail` - Receipts and papertrail items
1313+- `to-screen` - New emails needing manual review
1414+- Plus standard tags: `inbox`, `archive`, `spam`, `waiting`, `someday`, etc.
1515+1616+## Directory Structure
1717+1818+```
1919+~/.config/mutt/
2020+├── muttrc-notmuch # Main Neomutt config (use instead of muttrc)
2121+└── notmuch/
2222+ ├── README.md # This file
2323+ ├── notmuch-config # Notmuch database configuration
2424+ ├── notmuch_screening.sh # Tag-based screening script
2525+ ├── mbsyncrc.example # Example mbsync config (recommended)
2626+ └── sync/
2727+ ├── notmuch_sync.sh # Sync script for offlineimap + notmuch
2828+ └── mbsync_notmuch_sync.sh # Sync script for mbsync + notmuch (recommended)
2929+```
3030+3131+## Required Files (Already in Top-Level Directory)
3232+3333+These files from your existing setup are still needed:
3434+3535+- `~/.config/mutt/screened_in.txt` - List of approved email addresses
3636+- `~/.config/mutt/screened_out.txt` - List of blocked email addresses
3737+- `~/.config/mutt/feed.txt` - List of newsletter/feed email addresses
3838+- `~/.config/mutt/papertrail.txt` - List of papertrail email addresses
3939+- `~/.config/mutt/color.muttrc` - Your color scheme
4040+- `~/.config/mutt/signature` - Email signature
4141+- `~/.config/mutt/mailcap` - MIME type handlers
4242+- `~/.dotfiles/zsh/.secret.muttrc` - Password/secrets file
4343+4444+## Installation & Setup
4545+4646+### Prerequisites
4747+4848+Install required packages on Arch Linux:
4949+5050+```bash
5151+# For notmuch
5252+sudo pacman -S notmuch
5353+5454+# For mbsync (recommended over offlineimap)
5555+sudo pacman -S isync
5656+5757+# If keeping offlineimap
5858+sudo pacman -S offlineimap
5959+6060+# Required utilities (likely already installed)
6161+sudo pacman -S formail grep sed coreutils
6262+```
6363+6464+### Option 1: Keep offlineimap (Easier Migration)
6565+6666+1. **Initialize notmuch database:**
6767+ ```bash
6868+ notmuch setup
6969+ ```
7070+ - Database path: `/home/sspaeti/Documents/mutt/sspaeti.com`
7171+ - Your name: `Simon Späti`
7272+ - Primary email: `simon@ssp.sh`
7373+ - Other emails: `simon@sspaeti.com;simu@sspaeti.com`
7474+7575+2. **Or use the pre-configured notmuch-config:**
7676+ ```bash
7777+ export NOTMUCH_CONFIG=~/.config/mutt/notmuch/notmuch-config
7878+ notmuch new
7979+ ```
8080+8181+3. **Test the setup:**
8282+ ```bash
8383+ # Run initial screening
8484+ ~/.config/mutt/notmuch/notmuch_screening.sh
8585+8686+ # Launch Neomutt with notmuch config
8787+ neomutt -F ~/.config/mutt/muttrc-notmuch
8888+ ```
8989+9090+4. **Update your sync workflow:**
9191+ - Use `~/.config/mutt/notmuch/sync/notmuch_sync.sh` instead of your old sync script
9292+ - Or set up a cron job/systemd timer for automatic syncing
9393+9494+### Option 2: Upgrade to mbsync (Recommended)
9595+9696+**Why mbsync?**
9797+- 3-5x faster than offlineimap
9898+- Actively maintained (offlineimap is dormant)
9999+- Better IMAP compliance
100100+- Lower resource usage
101101+102102+**Setup Steps:**
103103+104104+1. **Configure mbsync:**
105105+ ```bash
106106+ cp ~/.config/mutt/notmuch/mbsyncrc.example ~/.mbsyncrc
107107+ ```
108108+109109+2. **Edit `~/.mbsyncrc`:**
110110+ - Update the `PassCmd` line to match your password method
111111+ - Verify folder names match your IMAP server
112112+113113+3. **Initial sync (takes a while):**
114114+ ```bash
115115+ mbsync -V sspaeti.com
116116+ ```
117117+118118+4. **Initialize notmuch:**
119119+ ```bash
120120+ export NOTMUCH_CONFIG=~/.config/mutt/notmuch/notmuch-config
121121+ notmuch new
122122+ ```
123123+124124+5. **Run initial screening:**
125125+ ```bash
126126+ ~/.config/mutt/notmuch/notmuch_screening.sh
127127+ ```
128128+129129+6. **Launch Neomutt:**
130130+ ```bash
131131+ neomutt -F ~/.config/mutt/muttrc-notmuch
132132+ ```
133133+134134+7. **Update your workflow:**
135135+ - Use `~/.config/mutt/notmuch/sync/mbsync_notmuch_sync.sh` for syncing
136136+137137+## Usage
138138+139139+### Starting Neomutt with Notmuch
140140+141141+```bash
142142+neomutt -F ~/.config/mutt/muttrc-notmuch
143143+```
144144+145145+Or create an alias in your shell config:
146146+```bash
147147+alias mutt="neomutt -F ~/.config/mutt/muttrc-notmuch"
148148+```
149149+150150+### Key Bindings (Same as Before!)
151151+152152+**Screening macros:**
153153+- `I` - Screen in sender (add to approved list, tag as `screened-in`)
154154+- `O` - Screen out sender (add to blocked list, tag as `screened-out`)
155155+- `F` - Add sender to Feed list (tag as `feed`)
156156+- `P` - Add sender to PaperTrail list (tag as `papertrail`)
157157+158158+**Navigation (using virtual mailboxes):**
159159+- `gi` - Go to INBOX
160160+- `gk` - Go to ToScreen (emails needing review)
161161+- `go` - Go to ScreenedOut
162162+- `gf` - Go to Feed
163163+- `gp` - Go to PaperTrail
164164+- `gw` - Go to Waiting
165165+- `gm` - Go to Someday
166166+- `ga` - Go to Archive
167167+- `gt` - Go to Trash
168168+- `gs` - Go to Sent
169169+170170+**Tagging macros:**
171171+- `Mi` - Tag as inbox
172172+- `Mo` - Tag as screened-out
173173+- `Mf` - Tag as feed
174174+- `Mp` - Tag as papertrail
175175+- `Mw` - Tag as waiting
176176+- `Mm` - Tag as someday
177177+- `Ma` - Tag as archive
178178+- `Mt` - Tag as trash
179179+180180+**Sync:**
181181+- `S` - Sync emails and run screening
182182+- `A` - Run screening only
183183+184184+### How Screening Works
185185+186186+1. **Automatic screening on sync:**
187187+ - New emails are indexed by notmuch
188188+ - Screening script checks sender against your lists
189189+ - Tags are applied automatically
190190+191191+2. **Manual screening:**
192192+ - Review emails in "ToScreen" mailbox (`gk`)
193193+ - Press `I` to approve sender → moves to INBOX
194194+ - Press `O` to block sender → tags as spam
195195+ - Press `F` for feeds, `P` for papertrail
196196+197197+3. **List updates:**
198198+ - When you approve/block a sender, their email is added to the respective .txt file
199199+ - Previously received emails from that sender are retagged automatically
200200+201201+## Files Explained
202202+203203+### notmuch-config
204204+Notmuch database configuration. Defines:
205205+- Database path
206206+- Your email addresses
207207+- Default tags for new emails
208208+- Synchronization settings
209209+210210+### notmuch_screening.sh
211211+Core screening logic. This script:
212212+1. Runs `notmuch new` to index new emails
213213+2. Reads your screened lists (screened_in.txt, screened_out.txt, etc.)
214214+3. Applies appropriate tags to emails based on sender
215215+4. Retags emails in ToScreen if sender status changed
216216+217217+**You should run this after each sync.**
218218+219219+### sync/notmuch_sync.sh
220220+Complete sync workflow for **offlineimap**:
221221+1. Checks Wi-Fi connection
222222+2. Runs offlineimap to fetch new emails
223223+3. Runs notmuch screening
224224+4. Syncs again to push any local changes
225225+226226+### sync/mbsync_notmuch_sync.sh
227227+Complete sync workflow for **mbsync**:
228228+1. Checks Wi-Fi connection
229229+2. Runs mbsync to fetch new emails
230230+3. Runs notmuch screening
231231+4. Syncs again to push any local changes
232232+233233+### mbsyncrc.example
234234+Template configuration for mbsync. Copy to `~/.mbsyncrc` and customize.
235235+236236+## Automation
237237+238238+### Systemd Timer (Recommended)
239239+240240+Create `~/.config/systemd/user/mutt-sync.service`:
241241+```ini
242242+[Unit]
243243+Description=Mutt Email Sync with Notmuch
244244+245245+[Service]
246246+Type=oneshot
247247+ExecStart=/home/sspaeti/.config/mutt/notmuch/sync/mbsync_notmuch_sync.sh
248248+```
249249+250250+Create `~/.config/systemd/user/mutt-sync.timer`:
251251+```ini
252252+[Unit]
253253+Description=Sync emails every 10 minutes
254254+255255+[Timer]
256256+OnBootSec=2min
257257+OnUnitActiveSec=10min
258258+259259+[Install]
260260+WantedBy=timers.target
261261+```
262262+263263+Enable and start:
264264+```bash
265265+systemctl --user enable --now mutt-sync.timer
266266+```
267267+268268+### Cron Job Alternative
269269+270270+Add to crontab (`crontab -e`):
271271+```bash
272272+*/10 * * * * /home/sspaeti/.config/mutt/notmuch/sync/mbsync_notmuch_sync.sh
273273+```
274274+275275+## Troubleshooting
276276+277277+### Notmuch can't find database
278278+```bash
279279+export NOTMUCH_CONFIG=~/.config/mutt/notmuch/notmuch-config
280280+notmuch new
281281+```
282282+283283+### Tags not applying
284284+Check that your .txt files have proper formatting:
285285+```bash
286286+# Remove trailing whitespace
287287+sed -i 's/[[:space:]]*$//' ~/.config/mutt/screened_in.txt
288288+```
289289+290290+### Virtual mailboxes empty
291291+Run notmuch manually to check:
292292+```bash
293293+notmuch search tag:to-screen
294294+notmuch search tag:inbox
295295+```
296296+297297+### mbsync authentication fails
298298+Check password command in `~/.mbsyncrc`:
299299+```bash
300300+# Test password retrieval
301301+grep HOSTPOINT_SMTP_PASSWORD_SIMU ~/.dotfiles/zsh/.secret.muttrc | cut -d'"' -f2
302302+```
303303+304304+## Migration from Folder-Based System
305305+306306+Your existing folder-based setup will continue to work. To migrate:
307307+308308+1. **Keep both configs** - Use `muttrc` for old system, `muttrc-notmuch` for new
309309+2. **Test thoroughly** with notmuch before fully switching
310310+3. **Your .txt files work with both** - They're shared between systems
311311+4. **No data loss** - Notmuch doesn't modify your maildir, just indexes it
312312+313313+## Advantages of Notmuch
314314+315315+1. **Multiple tags per email** - An email can be both "waiting" and "important"
316316+2. **Faster search** - Full-text search across all email
317317+3. **No file moving** - Tags are just metadata, files stay in place
318318+4. **Better threading** - Notmuch excels at conversation threading
319319+5. **Scriptable** - Easy to write custom tag rules
320320+321321+## Additional Resources
322322+323323+- [Notmuch Documentation](https://notmuchmail.org/documentation/)
324324+- [Neomutt Notmuch Integration](https://neomutt.org/feature/notmuch)
325325+- [mbsync Documentation](https://isync.sourceforge.io/mbsync.html)
326326+327327+## Support
328328+329329+If you encounter issues:
330330+1. Check logs in `~/.config/mutt/logs/`
331331+2. Run screening script manually to see errors
332332+3. Test notmuch commands directly: `notmuch search`, `notmuch tag`, etc.
+135
mutt/.config/mutt/notmuch/mbsyncrc.example
···11+# mbsync configuration for sspaeti.com
22+# This is a template - customize and rename to ~/.mbsyncrc or ~/.config/mbsync/mbsyncrc
33+44+# IMAP Account Configuration
55+IMAPAccount sspaeti.com
66+Host imap.mail.hostpoint.ch
77+Port 993
88+User simu@sspaeti.com
99+# You can use PassCmd to get password from a command instead of storing it
1010+# PassCmd "pass show email/sspaeti.com"
1111+# Or use a password file:
1212+# PassCmd "cat ~/.dotfiles/zsh/.secret-mbsync"
1313+# Or set it directly (less secure):
1414+# Pass yourpasswordhere
1515+PassCmd "grep HOSTPOINT_SMTP_PASSWORD_SIMU ~/.dotfiles/zsh/.secret.muttrc | cut -d'\"' -f2"
1616+SSLType IMAPS
1717+CertificateFile /etc/ssl/certs/ca-certificates.crt
1818+# For Arch Linux specifically:
1919+# CertificateFile /etc/ssl/cert.pem
2020+2121+# Remote IMAP Storage
2222+IMAPStore sspaeti.com-remote
2323+Account sspaeti.com
2424+2525+# Local Maildir Storage
2626+MaildirStore sspaeti.com-local
2727+Path ~/Documents/mutt/sspaeti.com/
2828+Inbox ~/Documents/mutt/sspaeti.com/INBOX
2929+SubFolders Verbatim
3030+3131+# Channel Configuration - Sync everything
3232+Channel sspaeti.com-inbox
3333+Far :sspaeti.com-remote:INBOX
3434+Near :sspaeti.com-local:INBOX
3535+Create Both
3636+Expunge Both
3737+SyncState *
3838+3939+Channel sspaeti.com-sent
4040+Far :sspaeti.com-remote:Sent
4141+Near :sspaeti.com-local:Sent
4242+Create Both
4343+Expunge Both
4444+SyncState *
4545+4646+Channel sspaeti.com-drafts
4747+Far :sspaeti.com-remote:Drafts
4848+Near :sspaeti.com-local:Drafts
4949+Create Both
5050+Expunge Both
5151+SyncState *
5252+5353+Channel sspaeti.com-trash
5454+Far :sspaeti.com-remote:Trash
5555+Near :sspaeti.com-local:Trash
5656+Create Both
5757+Expunge Both
5858+SyncState *
5959+6060+Channel sspaeti.com-junk
6161+Far :sspaeti.com-remote:Junk
6262+Near :sspaeti.com-local:Junk
6363+Create Both
6464+Expunge Both
6565+SyncState *
6666+6767+Channel sspaeti.com-archive
6868+Far :sspaeti.com-remote:Archive
6969+Near :sspaeti.com-local:Archive
7070+Create Both
7171+Expunge Both
7272+SyncState *
7373+7474+# Add any other folders you have
7575+Channel sspaeti.com-toscreen
7676+Far :sspaeti.com-remote:ToScreen
7777+Near :sspaeti.com-local:ToScreen
7878+Create Both
7979+Expunge Both
8080+SyncState *
8181+8282+Channel sspaeti.com-screenedout
8383+Far :sspaeti.com-remote:ScreenedOut
8484+Near :sspaeti.com-local:ScreenedOut
8585+Create Both
8686+Expunge Both
8787+SyncState *
8888+8989+Channel sspaeti.com-waiting
9090+Far :sspaeti.com-remote:Waiting
9191+Near :sspaeti.com-local:Waiting
9292+Create Both
9393+Expunge Both
9494+SyncState *
9595+9696+Channel sspaeti.com-someday
9797+Far :sspaeti.com-remote:Someday
9898+Near :sspaeti.com-local:Someday
9999+Create Both
100100+Expunge Both
101101+SyncState *
102102+103103+Channel sspaeti.com-feed
104104+Far :sspaeti.com-remote:Feed
105105+Near :sspaeti.com-local:Feed
106106+Create Both
107107+Expunge Both
108108+SyncState *
109109+110110+Channel sspaeti.com-papertrail
111111+Far :sspaeti.com-remote:PaperTrail
112112+Near :sspaeti.com-local:PaperTrail
113113+Create Both
114114+Expunge Both
115115+SyncState *
116116+117117+# Group all channels together
118118+Group sspaeti.com
119119+Channel sspaeti.com-inbox
120120+Channel sspaeti.com-sent
121121+Channel sspaeti.com-drafts
122122+Channel sspaeti.com-trash
123123+Channel sspaeti.com-junk
124124+Channel sspaeti.com-archive
125125+Channel sspaeti.com-toscreen
126126+Channel sspaeti.com-screenedout
127127+Channel sspaeti.com-waiting
128128+Channel sspaeti.com-someday
129129+Channel sspaeti.com-feed
130130+Channel sspaeti.com-papertrail
131131+132132+# Usage:
133133+# mbsync sspaeti.com # Sync all channels
134134+# mbsync sspaeti.com-inbox # Sync just inbox
135135+# mbsync -a # Sync all accounts
+28
mutt/.config/mutt/notmuch/notmuch-config
···11+# Notmuch configuration for email screening system
22+# This replaces folder-based organization with tag-based organization
33+44+[database]
55+path=/home/sspaeti/Documents/mutt/sspaeti.com
66+77+[user]
88+name=Simon Späti
99+primary_email=simon@ssp.sh
1010+other_email=simon@sspaeti.com;simu@sspaeti.com
1111+1212+[new]
1313+tags=unread;inbox;new
1414+ignore=
1515+1616+[search]
1717+exclude_tags=deleted;spam;
1818+1919+[maildir]
2020+synchronize_flags=true
2121+2222+# Initial tagging rules
2323+[new]
2424+# Tag all new mail with 'new' and 'inbox'
2525+tags=new;inbox;
2626+2727+# Auto-tagging based on folders (if needed for backward compatibility)
2828+# These will apply when notmuch indexes new mail
+94
mutt/.config/mutt/notmuch/notmuch_screening.sh
···11+#!/bin/bash
22+33+# Notmuch-based email screening script
44+# Uses tags instead of moving emails between folders
55+66+# Paths to screened lists
77+screened_in="$HOME/.dotfiles/mutt/.lists/screened_in.txt"
88+screened_out="$HOME/.dotfiles/mutt/.lists/screened_out.txt"
99+feed_list="$HOME/.dotfiles/mutt/.lists/feed.txt"
1010+papertrail_list="$HOME/.dotfiles/mutt/.lists/papertrail.txt"
1111+1212+# Create files if they don't exist
1313+touch "$screened_in" "$screened_out" "$feed_list" "$papertrail_list"
1414+1515+# Trim trailing spaces
1616+if [[ "$OSTYPE" == "darwin"* ]]; then
1717+ # macOS
1818+ sed -i '' 's/[[:space:]]*$//' "$screened_in"
1919+ sed -i '' 's/[[:space:]]*$//' "$screened_out"
2020+ sed -i '' 's/[[:space:]]*$//' "$feed_list"
2121+ sed -i '' 's/[[:space:]]*$//' "$papertrail_list"
2222+else
2323+ # Linux
2424+ sed -i 's/[[:space:]]*$//' "$screened_in"
2525+ sed -i 's/[[:space:]]*$//' "$screened_out"
2626+ sed -i 's/[[:space:]]*$//' "$feed_list"
2727+ sed -i 's/[[:space:]]*$//' "$papertrail_list"
2828+fi
2929+3030+# Set NOTMUCH_CONFIG to our custom location
3131+export NOTMUCH_CONFIG="$HOME/.config/mutt/notmuch/notmuch-config"
3232+3333+printf "Starting notmuch screening at $(date '+%Y-%m-%d %H:%M:%S')...\n"
3434+3535+# First, run notmuch new to index any new emails
3636+notmuch new
3737+3838+# Tag emails based on screened lists
3939+# Process screened_out emails
4040+while IFS= read -r email; do
4141+ [ -z "$email" ] && continue
4242+ printf "Tagging emails from %s as screened-out...\n" "$email"
4343+ notmuch tag +screened-out +spam -inbox -new -- from:"$email" tag:new
4444+done < "$screened_out"
4545+4646+# Process feed emails
4747+while IFS= read -r email; do
4848+ [ -z "$email" ] && continue
4949+ printf "Tagging emails from %s as feed...\n" "$email"
5050+ notmuch tag +feed -inbox -new -- from:"$email" tag:new
5151+done < "$feed_list"
5252+5353+# Process papertrail emails
5454+while IFS= read -r email; do
5555+ [ -z "$email" ] && continue
5656+ printf "Tagging emails from %s as papertrail...\n" "$email"
5757+ notmuch tag +papertrail -inbox -new -- from:"$email" tag:new
5858+done < "$papertrail_list"
5959+6060+# Process screened_in emails (approved senders)
6161+while IFS= read -r email; do
6262+ [ -z "$email" ] && continue
6363+ printf "Tagging emails from %s as screened-in...\n" "$email"
6464+ notmuch tag +screened-in -to-screen -new -- from:"$email" tag:new
6565+done < "$screened_in"
6666+6767+# Tag remaining new emails that don't match any list as needing screening
6868+printf "Tagging remaining new emails as to-screen...\n"
6969+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
7070+7171+# Move previously screened emails if sender status changed
7272+printf "Updating tags for emails in to-screen based on current lists...\n"
7373+7474+# Check to-screen emails and retag if sender is now in a list
7575+for msg_id in $(notmuch search --output=messages tag:to-screen); do
7676+ 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,}')
7777+7878+ if grep -Fxq "$sender" "$screened_in"; then
7979+ notmuch tag +screened-in +inbox -to-screen -- id:"$msg_id"
8080+ printf "Moved %s back to inbox (screened-in)\n" "$msg_id"
8181+ elif grep -Fxq "$sender" "$screened_out"; then
8282+ notmuch tag +screened-out +spam -to-screen -inbox -- id:"$msg_id"
8383+ printf "Tagged %s as screened-out\n" "$msg_id"
8484+ elif grep -Fxq "$sender" "$feed_list"; then
8585+ notmuch tag +feed -to-screen -inbox -- id:"$msg_id"
8686+ printf "Tagged %s as feed\n" "$msg_id"
8787+ elif grep -Fxq "$sender" "$papertrail_list"; then
8888+ notmuch tag +papertrail -to-screen -inbox -- id:"$msg_id"
8989+ printf "Tagged %s as papertrail\n" "$msg_id"
9090+ fi
9191+done
9292+9393+printf "Notmuch screening completed at $(date '+%Y-%m-%d %H:%M:%S')\n"
9494+printf -- "####################################\n"
···11+#!/bin/bash
22+33+# mbsync + Notmuch sync script for neomutt (Linux/Arch)
44+# Syncs email with mbsync and applies notmuch screening tags
55+66+# Log file path
77+LOG_FILE=~/.config/mutt/logs/mbsync_notmuch_sync_status.log
88+99+# Create log directory if it doesn't exist
1010+mkdir -p ~/.config/mutt/logs
1111+1212+# Function to check if connected to Wi-Fi (Linux)
1313+check_wifi() {
1414+ # Check if any wireless interface is connected
1515+ if command -v nmcli &> /dev/null; then
1616+ # Using NetworkManager
1717+ if nmcli -t -f DEVICE,STATE device | grep -q "wifi:connected"; then
1818+ return 0 # Connected to Wi-Fi
1919+ fi
2020+ elif command -v iwgetid &> /dev/null; then
2121+ # Fallback to iwgetid
2222+ if iwgetid -r &> /dev/null; then
2323+ return 0 # Connected to Wi-Fi
2424+ fi
2525+ fi
2626+ return 1 # Not connected to Wi-Fi
2727+}
2828+2929+# Log start time
3030+echo "mbsync + Notmuch sync started at $(date)" >> "$LOG_FILE"
3131+3232+# Check if connected to Wi-Fi
3333+if check_wifi; then
3434+ # Run the first sync with mbsync
3535+ echo "Running mbsync..." >> "$LOG_FILE"
3636+ mbsync sspaeti.com
3737+3838+ # Wait for 2 seconds
3939+ sleep 2
4040+4141+ # Run the notmuch screener
4242+ echo "Running notmuch screening..." >> "$LOG_FILE"
4343+ ~/.config/mutt/notmuch/notmuch_screening.sh >> ~/.config/mutt/logs/notmuch_screening.log 2>&1
4444+4545+ # Wait for 2 seconds
4646+ sleep 2
4747+4848+ # Run the second sync (to sync any local changes back)
4949+ echo "Running second mbsync..." >> "$LOG_FILE"
5050+ mbsync sspaeti.com
5151+5252+ echo "mbsync + Notmuch sync completed successfully at $(date)" >> "$LOG_FILE"
5353+else
5454+ echo "Not connected to Wi-Fi. Sync not performed at $(date)" >> "$LOG_FILE"
5555+fi
5656+5757+# Keep only last 100 lines of log
5858+tail -100 "$LOG_FILE" > "$LOG_FILE.tmp" && mv "$LOG_FILE.tmp" "$LOG_FILE"
+58
mutt/.config/mutt/notmuch/sync/notmuch_sync.sh
···11+#!/bin/bash
22+33+# Notmuch-based sync script for neomutt (Linux/Arch)
44+# Syncs email with offlineimap and applies notmuch screening tags
55+66+# Log file path
77+LOG_FILE=~/.config/mutt/logs/notmuch_sync_status.log
88+99+# Create log directory if it doesn't exist
1010+mkdir -p ~/.config/mutt/logs
1111+1212+# Function to check if connected to Wi-Fi (Linux)
1313+check_wifi() {
1414+ # Check if any wireless interface is connected
1515+ if command -v nmcli &> /dev/null; then
1616+ # Using NetworkManager
1717+ if nmcli -t -f DEVICE,STATE device | grep -q "wifi:connected"; then
1818+ return 0 # Connected to Wi-Fi
1919+ fi
2020+ elif command -v iwgetid &> /dev/null; then
2121+ # Fallback to iwgetid
2222+ if iwgetid -r &> /dev/null; then
2323+ return 0 # Connected to Wi-Fi
2424+ fi
2525+ fi
2626+ return 1 # Not connected to Wi-Fi
2727+}
2828+2929+# Log start time
3030+echo "Notmuch sync started at $(date)" >> "$LOG_FILE"
3131+3232+# Check if connected to Wi-Fi
3333+if check_wifi; then
3434+ # Run the first sync with offlineimap
3535+ echo "Running offlineimap..." >> "$LOG_FILE"
3636+ offlineimap -a sspaeti.com
3737+3838+ # Wait for 2 seconds
3939+ sleep 2
4040+4141+ # Run the notmuch screener
4242+ echo "Running notmuch screening..." >> "$LOG_FILE"
4343+ ~/.config/mutt/notmuch/notmuch_screening.sh >> ~/.config/mutt/logs/notmuch_screening.log 2>&1
4444+4545+ # Wait for 2 seconds
4646+ sleep 2
4747+4848+ # Run the second sync (to sync any local changes back)
4949+ echo "Running second offlineimap sync..." >> "$LOG_FILE"
5050+ offlineimap -a sspaeti.com
5151+5252+ echo "Notmuch sync completed successfully at $(date)" >> "$LOG_FILE"
5353+else
5454+ echo "Not connected to Wi-Fi. Sync not performed at $(date)" >> "$LOG_FILE"
5555+fi
5656+5757+# Keep only last 100 lines of log
5858+tail -100 "$LOG_FILE" > "$LOG_FILE.tmp" && mv "$LOG_FILE.tmp" "$LOG_FILE"
+134
mutt/.mbsyncrc
···11+# mbsync configuration for sspaeti.com
22+# This is a template - customize and rename to ~/.mbsyncrc or ~/.config/mbsync/mbsyncrc
33+44+# IMAP Account Configuration
55+IMAPAccount sspaeti.com
66+Host imap.mail.hostpoint.ch
77+Port 993
88+User simu@sspaeti.com
99+# You can use PassCmd to get password from a command instead of storing it
1010+# PassCmd "pass show email/sspaeti.com"
1111+# Or use a password file:
1212+# PassCmd "cat ~/.dotfiles/zsh/.secret-mbsync"
1313+# Or set it directly (less secure):
1414+# Pass yourpasswordhere
1515+PassCmd "grep imap_pass ~/.dotfiles/zsh/.secret.muttrc | cut -d'\"' -f2"
1616+TLSType IMAPS
1717+# For Arch Linux:
1818+CertificateFile /etc/ssl/cert.pem
1919+2020+# Remote IMAP Storage
2121+IMAPStore sspaeti.com-remote
2222+Account sspaeti.com
2323+2424+# Local Maildir Storage
2525+MaildirStore sspaeti.com-local
2626+Path ~/Documents/mutt/sspaeti.com/
2727+Inbox ~/Documents/mutt/sspaeti.com/INBOX
2828+SubFolders Verbatim
2929+3030+# Channel Configuration - Sync everything
3131+Channel sspaeti.com-inbox
3232+Far :sspaeti.com-remote:INBOX
3333+Near :sspaeti.com-local:INBOX
3434+Create Both
3535+Expunge Both
3636+SyncState *
3737+3838+Channel sspaeti.com-sent
3939+Far :sspaeti.com-remote:Sent
4040+Near :sspaeti.com-local:Sent
4141+Create Both
4242+Expunge Both
4343+SyncState *
4444+4545+Channel sspaeti.com-drafts
4646+Far :sspaeti.com-remote:Drafts
4747+Near :sspaeti.com-local:Drafts
4848+Create Both
4949+Expunge Both
5050+SyncState *
5151+5252+Channel sspaeti.com-trash
5353+Far :sspaeti.com-remote:Trash
5454+Near :sspaeti.com-local:Trash
5555+Create Both
5656+Expunge Both
5757+SyncState *
5858+5959+Channel sspaeti.com-junk
6060+Far :sspaeti.com-remote:Junk
6161+Near :sspaeti.com-local:Junk
6262+Create Both
6363+Expunge Both
6464+SyncState *
6565+6666+Channel sspaeti.com-archive
6767+Far :sspaeti.com-remote:Archive
6868+Near :sspaeti.com-local:Archive
6969+Create Both
7070+Expunge Both
7171+SyncState *
7272+7373+# Add any other folders you have
7474+Channel sspaeti.com-toscreen
7575+Far :sspaeti.com-remote:ToScreen
7676+Near :sspaeti.com-local:ToScreen
7777+Create Both
7878+Expunge Both
7979+SyncState *
8080+8181+Channel sspaeti.com-screenedout
8282+Far :sspaeti.com-remote:ScreenedOut
8383+Near :sspaeti.com-local:ScreenedOut
8484+Create Both
8585+Expunge Both
8686+SyncState *
8787+8888+Channel sspaeti.com-waiting
8989+Far :sspaeti.com-remote:Waiting
9090+Near :sspaeti.com-local:Waiting
9191+Create Both
9292+Expunge Both
9393+SyncState *
9494+9595+Channel sspaeti.com-someday
9696+Far :sspaeti.com-remote:Someday
9797+Near :sspaeti.com-local:Someday
9898+Create Both
9999+Expunge Both
100100+SyncState *
101101+102102+Channel sspaeti.com-feed
103103+Far :sspaeti.com-remote:Feed
104104+Near :sspaeti.com-local:Feed
105105+Create Both
106106+Expunge Both
107107+SyncState *
108108+109109+Channel sspaeti.com-papertrail
110110+Far :sspaeti.com-remote:PaperTrail
111111+Near :sspaeti.com-local:PaperTrail
112112+Create Both
113113+Expunge Both
114114+SyncState *
115115+116116+# Group all channels together
117117+Group sspaeti.com
118118+Channel sspaeti.com-inbox
119119+Channel sspaeti.com-sent
120120+Channel sspaeti.com-drafts
121121+Channel sspaeti.com-trash
122122+Channel sspaeti.com-junk
123123+Channel sspaeti.com-archive
124124+Channel sspaeti.com-toscreen
125125+Channel sspaeti.com-screenedout
126126+Channel sspaeti.com-waiting
127127+Channel sspaeti.com-someday
128128+Channel sspaeti.com-feed
129129+Channel sspaeti.com-papertrail
130130+131131+# Usage:
132132+# mbsync sspaeti.com # Sync all channels
133133+# mbsync sspaeti.com-inbox # Sync just inbox
134134+# mbsync -a # Sync all accounts