From 98f80757e01343143a7be5c7f0d582d0243c6a74 Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Thu, 11 Jun 2026 21:14:17 +0200 Subject: [PATCH] Add mailbox account --- mail.org | 104 ++++++++++++++++++++++++++++++++++++++++ qutebrowser.org | 2 +- scripts/install-mail.sh | 14 ++++++ systemd.org | 8 ++-- 4 files changed, 124 insertions(+), 4 deletions(-) diff --git a/mail.org b/mail.org index 44c207b..1a860ca 100644 --- a/mail.org +++ b/mail.org @@ -185,6 +185,61 @@ Expunge Near Sync Pull #+END_SRC +** Mailbox Account +#+BEGIN_SRC conf +IMAPAccount mailbox +Host imap.mailbox.org +User thomas@tdehaeze.xyz +PassCmd "pass email/thomas@tdehaeze.xyz" +TLSType IMAPS +AuthMechs LOGIN +#+END_SRC + +#+BEGIN_SRC conf +IMAPStore mailbox-remote +Account mailbox + +MaildirStore mailbox-local +Path ~/.local/share/mails/mailbox/ +Inbox ~/.local/share/mails/mailbox/Inbox + +Channel mailbox-Home +Far :mailbox-remote:INBOX +Near :mailbox-local:Inbox + +Channel mailbox-Drafts +Far :mailbox-remote:Drafts +Near :mailbox-local:Drafts + +Channel mailbox-Archive +Far :mailbox-remote:Archive +Near :mailbox-local:Archive + +Channel mailbox-Sent +Far :mailbox-remote:Sent +Near :mailbox-local:Sent + +Channel mailbox-Trash +Far :mailbox-remote:Trash +Near :mailbox-local:Trash +#+END_SRC + +#+BEGIN_SRC conf +Channel mailbox +Far :mailbox-remote: +Near :mailbox-local: +#+END_SRC + +For doing a quick sync of just the INBOX with =mbsync mailbox-download=. +#+BEGIN_SRC conf +Channel mailbox-download +Far :mailbox-remote:INBOX +Near :mailbox-local:Inbox +Create Near +Expunge Near +Sync Pull +#+END_SRC + ** ESRF Account #+BEGIN_SRC conf IMAPAccount esrf @@ -269,6 +324,17 @@ passwordeval "pass email/dehaeze.thomas@gmail.com" # proxy_port 8080 #+END_SRC +** Mailbox Account +#+BEGIN_SRC conf +account mailbox +host smtp.mailbox.org +port 587 +protocol smtp +from thomas@tdehaeze.xyz +user thomas@tdehaeze.xyz +passwordeval "pass email/thomas@tdehaeze.xyz" +#+END_SRC + ** ESRF Account #+BEGIN_SRC conf account esrf @@ -1031,9 +1097,11 @@ set from = "thomas.dehaeze@esrf.fr" folder-hook gmail/* source $HOME/.config/neomutt/accounts/gmail folder-hook esrf/* source $HOME/.config/neomutt/accounts/esrf +folder-hook mailbox/* source $HOME/.config/neomutt/accounts/mailbox macro index,pager ge "+esrf/Inbox" "go to inbox" macro index,pager gm "+gmail/Inbox" "go to inbox" +macro index,pager gb "+mailbox/Inbox" "go to inbox" #+END_SRC *** Gmail @@ -1067,6 +1135,36 @@ This empty code block is used to add a new line after signature #+begin_src conf :tangle ~/.config/neomutt/accounts/gmail.signature :comments none :padline no #+end_src +*** Mailbox +**** Configuration +#+begin_src conf :tangle ~/.config/neomutt/accounts/mailbox :comments none +set from = "thomas@tdehaeze.xyz" +set sendmail = "$HOME/.config/neomutt/bin/send_mail.sh mailbox" + +# Other special folders. +set mbox = "+mailbox/Archive" +set record = "+mailbox/Sent" +set postponed = "+mailbox/Drafts" + +set signature = "$HOME/.config/neomutt/accounts/mailbox.signature" + +macro index,pager d \ + "+mailbox/Archive" \ + "Move message to the Archive" + +macro index,pager D \ + "+mailbox/Trash" \ + "Move message to the Trash" +#+end_src + +**** Signature +#+begin_src conf :tangle ~/.config/neomutt/accounts/mailbox.signature :comments none :padline no +Thomas DEHAEZE +#+end_src +This empty code block is used to add a new line after signature +#+begin_src conf :tangle ~/.config/neomutt/accounts/mailbox.signature :comments none :padline no +#+end_src + *** ESRF **** Configuration #+begin_src conf :tangle ~/.config/neomutt/accounts/esrf :comments none @@ -1257,6 +1355,12 @@ named-mailboxes "  Sent" =gmail/Sent named-mailboxes "  Drafts" =gmail/Drafts named-mailboxes "  Archive" =gmail/Archive named-mailboxes "  Trash" =gmail/Trash +named-mailboxes " MAILBOX" =empty/mailbox +named-mailboxes "  Inbox" =mailbox/Inbox +named-mailboxes "  Sent" =mailbox/Sent +named-mailboxes "  Drafts" =mailbox/Drafts +named-mailboxes "  Archive" =mailbox/Archive +named-mailboxes "  Trash" =mailbox/Trash named-mailboxes " ESRF" =empty/esrf named-mailboxes "  Inbox" =esrf/Inbox named-mailboxes "  Sent" =esrf/Sent diff --git a/qutebrowser.org b/qutebrowser.org index 25cf611..2412279 100644 --- a/qutebrowser.org +++ b/qutebrowser.org @@ -420,7 +420,7 @@ config.bind(',q', 'QRcode') ** Create a new password #+begin_src bash :tangle ~/.config/qutebrowser/userscripts/add-passowrd.sh url=$(echo "$QUTE_URL" | awk -F[/:] '{print $4}' | grep -oP '[\w-]+\.[\w-]+$' | rofi -i -p "URL" -dmenu -lines 1) -username=$(echo -e "dehaeze.thomas@gmail.com\nthomas.dehaeze@esrf.fr\ntdehaeze" | rofi -p "Username" -dmenu -lines 5) +username=$(echo -e "thomas@tdehaeze.xyz\ndehaeze.thomas@gmail.com\nthomas.dehaeze@esrf.fr\ntdehaeze" | rofi -p "Username" -dmenu -lines 5) password=$(rofi -p "Password" -dmenu -password -lines 1) if [ -z "$url" ] || [ -z "$username" ] || [ -z "$password" ]; then diff --git a/scripts/install-mail.sh b/scripts/install-mail.sh index 0748ab8..84deccb 100755 --- a/scripts/install-mail.sh +++ b/scripts/install-mail.sh @@ -8,3 +8,17 @@ paru -S --needed --noconfirm \ neomutt \ mu \ lynx urlview + +echo "==> Tangling mail.org" +emacsclient -e '(org-babel-tangle-file "/home/thomas/.config/literate-dotfiles/mail.org")' + +echo "==> Creating mail directories" +mkdir -p ~/.local/share/mails/{gmail,esrf,search,empty} +mkdir -p ~/.local/share/mails/gmail/{Inbox,Sent,Drafts,Archive,Trash} +mkdir -p ~/.local/share/mails/esrf/{Inbox,Sent,Drafts,Archive,Trash} +mkdir -p ~/.local/share/mails/search/{cur,new,tmp} +mkdir -p ~/.local/share/mails/empty/gmail/{cur,new,tmp} +mkdir -p ~/.local/share/mails/empty/esrf/{cur,new,tmp} + +echo "==> Getting all the emails" +mbsync -a diff --git a/systemd.org b/systemd.org index b25f7b2..67d84f9 100644 --- a/systemd.org +++ b/systemd.org @@ -220,18 +220,20 @@ done # Count number of new mails before retreiving mails gmail_old="$(ls ~/.local/share/mails/gmail/Inbox/new | wc -l)" +mailbox_old="$(ls ~/.local/share/mails/mailbox/Inbox/new | wc -l)" esrf_old="$(ls ~/.local/share/mails/esrf/Inbox/new | wc -l)" # Retreive mails -mbsync -c /home/thomas/.config/isync/mbsyncrc $opt_all $opt_verbose gmail-Home esrf-Home 2>/tmp/mbsync.log +mbsync -c /home/thomas/.config/isync/mbsyncrc $opt_all $opt_verbose gmail-Home mailbox-Home esrf-Home 2>/tmp/mbsync.log # Count number of new mails after retreiving mails gmail_new="$(ls ~/.local/share/mails/gmail/Inbox/new | wc -l)" +mailbox_new="$(ls ~/.local/share/mails/mailbox/Inbox/new | wc -l)" esrf_new="$(ls ~/.local/share/mails/esrf/Inbox/new | wc -l)" # Notification if there are new retreive mails -if [ "$(($esrf_new+$gmail_new))" -gt "$(($esrf_old+$gmail_old))" ]; then - dunstify --replace=98465 'Mails ' "$(($gmail_new+$esrf_new)) new mail(s)" +if [ "$(($esrf_new+$mailbox_new+$gmail_new))" -gt "$(($esrf_old+$mailbox_old+$gmail_old))" ]; then + dunstify --replace=98465 'Mails ' "$(($gmail_new+$mailbox_new+$esrf_new)) new mail(s)" fi # Indexation and Tags