mail: Improve sent folder redirection

This commit is contained in:
TEC 2022-10-02 22:38:32 +08:00
parent 7043ecfc25
commit 6b204fd097
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 9 additions and 5 deletions

View File

@ -6633,11 +6633,15 @@ Speaking of, it would be good to put emails sent from =@tecosaur.net= in the
account-specific sent directory, not the catch-all.
#+begin_src emacs-lisp
(defun +mu4e-account-sent-folder (msg)
(if (string-match-p "@tecosaur\\.net\\'"
(plist-get (car (plist-get msg :from)) :email))
"/tecosaur-net/sent"
"/sent"))
(defun +mu4e-account-sent-folder (&optional msg)
(let ((from (if msg
(plist-get (car (plist-get msg :from)) :email)
(save-restriction
(mail-narrow-to-head)
(mail-fetch-field "from")))))
(if (and from (string-match-p "@tecosaur\\.net>?\\'" from))
"/tecosaur-net/Sent"
"/sent")))
(setq mu4e-sent-folder #'+mu4e-account-sent-folder)
#+end_src