djcb / mu

maildir indexer/searcher + emacs mail client + guile bindings
http://www.djcbsoftware.nl/code/mu
GNU General Public License v3.0
1.59k stars 384 forks source link

Fix: Put sent mail in correct location when `mu4e-sent-messages-behavior` is a function #2698

Closed josephmturner closed 2 months ago

josephmturner commented 2 months ago

The second commit is just a stylistic change. If pcase-exhaustive is not preferred in this case, I'd be curious to hear why.

Thank you for all your work on mu4e!!!

Joseph

josephmturner commented 2 months ago

For anyone else who was affected by this regression, here's how I made sure that my sent mails were being backed up on my email server.

First, I examined the directory into which sent mail was erroneously being moved, which on my machine was ~/.local/share/mail/cur/, to see how far back the sent emails were misplaced. In my case, all sent emails in April ended up there and were therefore not being backed up to my webmail server.

Then, I performed a search in mu4e to match those emails. Using my saved sent mail maildir bookmarks wouldn't work because the sent mails were not in the correct location. In my case, the from:joseph search matched the misplaced mail.

Then, with mu4e-refile-folder set to something like this...

(lambda (msg)
  (cond
   ((and-let* ((from (mu4e-message-sent-by-me msg))
               ((string-suffix-p "@my-domain-1.org" (plist-get from :email)))))
    "/my-domain-1/Sent")
   ((and-let* ((from (mu4e-message-sent-by-me msg))
               ((string-suffix-p "@my-domain-2.org" (plist-get from :email)))))
    "/my-domain-2/Sent")))

...I marked all of the mail sent by any of my email addresses in April, then pressed r x y to refile them all into their correct locations.

To confirm that the refiling worked, I reverted the Dired buffer showing ~/.local/share/mail/cur/ to see that it was empty (all of the files had been moved out of there). Finally, I ran mu4e-update-mail-and-index before using my email server's webmail client to check that the sent mails were now backed up to the server. 🎉

djcb commented 2 months ago

Ah, good catch!

josephmturner commented 2 months ago

I've pushed the changes. Feel free to squash merge if you like. Thank you!!

djcb commented 2 months ago

Okay, I'll merge it now, thanks! I'll tweak it bit later, but anyway the eternal glory goes to you for fixing the problem!

josephmturner commented 2 months ago

Thank you!!