djcb / mu

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

[mu4e bug] mark to "delete" using "d" moves the mail to archive #2562

Closed sangkookchoi closed 1 year ago

sangkookchoi commented 1 year ago

Describe the bug Please provide a clear and concise description of what you expected to happen and what actually happened.

In the inbox, when I mark an unread email with "d" to move it to trash, mu4e moves the email to "archive", not trash. When I mark the email in "archive" with "d", then the mail moves to trash.

How to Reproduce Include the exact steps of what you were doing (commands executed etc.). Include any relevant logs and outputs. Best start with emacs -Q and a minimal mu4e setup. Below is the my setup.

(setq mail-user-agent 'mu4e-user-agent)
(require 'smtpmail)
(require 'unicode-fonts)
(require 'persistent-soft) ; To cache the fonts and reduce load time
(unicode-fonts-setup)
(use-package org-mime
  :ensure t)

(use-package mu4e
  :load-path  "/opt/homebrew/share/emacs/site-lisp/mu/mu4e/"
  :bind
  ("C-c m" . mu4e )
  :config
  ;; we installed this with homebrew
  (setq mu4e-mu-binary
    (executable-find "mu")      
    ;; (executable-find "mu --muhome ~/Documents/mail/mu")
    ;; (concat (executable-find "mu") " --muhome ~/Documents/mail/mu")
    )

  ;; this is the directory we created before:
  (setq mu4e-maildir "~/.maildir")
  ;; (setq mu4e-mu-home "~/Documents/mail/mu")

  ;; this command is called to sync imap servers:
  (setq mu4e-get-mail-command (concat (executable-find "mbsync") " -a"))
  ;; how often to call it in seconds:
  (setq mu4e-update-interval 60)

  ;; save attachment to desktop by default
  ;; or another choice of yours:
  (setq mu4e-attachment-dir "~/Downloads")

  ;; rename files when moving - needed for mbsync:
  (setq mu4e-change-filenames-when-moving t)

  ;; list of your email adresses:
  (setq mu4e-user-mail-address-list '("xxxxx@gmail.com"
                      "xxxxx@icloud.com"
                      ))

  ;; check your ~/.maildir to see how the subdirectories are called
  ;; for the generic imap account:
  ;; e.g `ls ~/.maildir/example'
  (setq   mu4e-maildir-shortcuts
          '(
            ("/gmail/Archive"  . ?g)
            ("/icloud/Archive"  . ?i)     
        ))

  ;; (defvar mu4e-bookmarks 'nil)
  (setq mu4e-bookmarks
    '(
      ("maildir:/gmail/INBOX OR maildir:/icloud/INBOX" "All Inboxes" ?i)
      ("maildir:/gmail/Sent OR maildir:/icloud/Sent" "All Sent" ?s)
      ("maildir:/gmail/Drafts OR maildir:/icloud/Drafts" "All Drafts" ?d)     
      ("maildir:/gmail/Archive OR maildir:/icloud/Archive" "All Archives" ?a)
      ("maildir:/gmail/Junk OR maildir:/icloud/Junk" "All Junks" ?j)
      ("maildir:/gmail/Trash OR maildir:/icloud/Trash" "All Trashes" ?t)
      ("date:today..now" "Today's messages" ?d)   
      ("date:7d..now" "Last 7 days" ?w)
      ;; ("flag:unread AND NOT flag:trashed" "Unread messages" ?u)    
      )
    )

  (setq mu4e-contexts
    `( ,(make-mu4e-context
             :name "gmail"
             :enter-func
             (lambda () (mu4e-message "Enter xxxxx@gmail.com context"))
             :leave-func
             (lambda () (mu4e-message "Leave xxxxx@gmail.com context"))
             :match-func
             (lambda (msg)
               (when msg
         (mu4e-message-contact-field-matches msg
                                                     :to "xxxxx@gmail.com")))
             :vars '((user-mail-address . "xxxxx@gmail.com" )
                     (user-full-name . "gmail")
                     (mu4e-drafts-folder . "/gmail/Drafts")
                     (mu4e-sent-folder . "/gmail/Sent")
                     (mu4e-trash-folder . "/gmail/Trash")
                     (mu4e-refile-folder . "/gmail/Archive")

             )) 
       ,(make-mu4e-context
             :name "icloud"
             :enter-func
             (lambda () (mu4e-message "Enter xxxxx@icloud.com context"))
             :leave-func
             (lambda () (mu4e-message "Leave xxxxx@icloud.com context"))
             :match-func
             (lambda (msg)
               (when msg
         (mu4e-message-contact-field-matches msg
                                                     :to "xxxxx@icloud.com")))
             :vars '((user-mail-address . "xxxxx@icloud.com" )
                     (user-full-name . "icloud")
                     (mu4e-drafts-folder . "/icloud/Drafts")
                     (mu4e-sent-folder . "/icloud/Sent")
                     (mu4e-trash-folder . "/icloud/Trash")
                     (mu4e-refile-folder . "/icloud/Archive")

             )) 
       ))

  (setq mu4e-context-policy 'pick-first) ;; start with the first (default) context;
  (setq mu4e-compose-context-policy 'ask) ;; ask for context if no context matches;

  ;; gpg encryptiom & decryption:
  ;; this can be left alone
  (require 'epa-file)
  (epa-file-enable)
  (setq epa-pinentry-mode 'loopback)
  (auth-source-forget-all-cached)

  ;; don't keep message compose buffers around after sending:
  (setq message-kill-buffer-on-exit t)

  ;; send function:
  (setq send-mail-function 'sendmail-send-it
    message-send-mail-function 'sendmail-send-it)

  ;; send program:
  ;; this is exeranal. remember we installed it before.
  (setq sendmail-program
    (executable-find "msmtp")
    ;; (concat (executable-find "msmtp") " --file=~/Documents/mail/msmtprc")
    )

  ;; select the right sender email from the context.
  (setq message-sendmail-envelope-from 'header)

  ;; chose from account before sending
  ;; this is a custom function that works for me.
  ;; well I stole it somewhere long ago.
  ;; I suggest using it to make matters easy
  ;; of course adjust the email adresses and account descriptions
  (defun timu/set-msmtp-account ()
    (if (message-mail-p)
    (save-excursion
          (let*
              ((from (save-restriction
                       (message-narrow-to-headers)
                       (message-fetch-field "from")))
               (account
        (cond
         ((string-match "xxxxx@gmail.com" from) "gmail")           
         ((string-match "xxxxx@icloud.com" from) "icloud")
         )))
            (setq message-sendmail-extra-arguments (list '"-a" account))))))

  (add-hook 'message-send-mail-hook 'timu/set-msmtp-account)

  ;; mu4e cc & bcc
  ;; this is custom as well
  (add-hook 'mu4e-compose-mode-hook
            (defun timu/add-cc-and-bcc ()
              "My Function to automatically add Cc & Bcc: headers.
    This is in the mu4e compose mode."
              (save-excursion (message-add-header "Cc:\n"))
              (save-excursion (message-add-header "Bcc:\n"))))

  ;; mu4e address completion
  (add-hook 'mu4e-compose-mode-hook 'company-mode)
  (add-hook 'mu4e-compose-mode-hook (lambda () (auto-fill-mode -1)))
  (add-hook 'mu4e-compose-mode-hook (lambda () (set-fill-column 99999999)))
  (setq mu4e-html2text-command
    "textutil -stdin -format html -convert txt -stdout")  
  ;; store link to message if in header view, not to header query:
  (setq org-mu4e-link-query-in-headers-mode nil)
  (setq mu4e-headers-auto-update t) 
  ;; don't have to confirm when quitting:
  (setq mu4e-confirm-quit nil)
  ;; ;; number of visible headers in horizontal split view:
  ;; (setq mu4e-headers-visible-lines 20)
  ;; ;; don't show threading by default:
  ;; (setq mu4e-headers-show-threads nil)
  ;; hide annoying "mu4e Retrieving mail..." msg in mini buffer:
  (setq mu4e-hide-index-messages t)
  ;; customize the reply-quote-string:
  (setq message-citation-line-format "%N @ %Y-%m-%d %H:%M :\n")
  ;; M-x find-function RET message-citation-line-format for docs:
  (setq message-citation-line-function 'message-insert-formatted-citation-line)
  ;; by default do not show related emails:
  (setq mu4e-headers-include-related nil)
  ;; ;; by default do not show threads:
  ;; (setq mu4e-headers-show-threads nil)
  (setq mu4e-view-show-images t)
  (setq mu4e-use-fancy-chars t)
  )

Environment Please describe the versions of OS, Emacs, mu/mu4e etc. you are using.

Mac OS Sonoma 14.0, emacs 29.1, mu4e 1.10.7

Checklist

Please make sure you all items in the checklist are set/met before filing the ticket. Thank you!

djcb commented 1 year ago

Hmmm.. so when in the headers, you call mu4e-headers-mark-for-trash (or use the keybinding); and you see something like -> /path/to/trash? Or something else? What does it say exactly? And what's the value of mu4e-trash-folder at that time? (i.e.., C-h v mu4e-trash-folder RET)

sangkookchoi commented 1 year ago

Thanks for your reply. When I make email with "d", it points to correct path to trash such as "/icloud/Trash" or "gmail/Trash". For the "mu4e-trash-folder", it is "/icloud/Trash" In the context of "iCloud" and it is "/gmail/Trash" In the context of "gmail"

djcb commented 1 year ago

So in both contexts, "d" move the message to either /icloud/archive or /gmail/archive rather than trash, even though it shows points to the correct path? And this happens immediately when checking archive after move?

What does the debug log say (try M-x mu4e-toggle-logging) when you try to "trash" the messages? It should look something like this:

2023-10-03 19:20:18.734 -> (mkdir :path "/home/djcb/Maildir/trash" :update nil)
2023-10-03 19:20:18.734 -> (move :docid 98693 :msgid nil :flags "+T-N" :maildir "/trash" :rename nil :no-view nil)

Also ensure mbsync is not running in the mean time, and turn off showing related messages.

sangkookchoi commented 1 year ago

Hi, Thanks again for your reply. Please see below

Dirk-Jan C. Binnema @ 2023-10-03 09:28 :

So in both contexts, "d" move the message to either /icloud/archive or /gmail/archive rather than trash, even though it shows points to the correct path?

=> This behavior only happens for the mail sent to my gmail account. "d" moves mail sent to gmail to gmail/archive regardless of the context

And this happens immediately when checking archive after move? => Yes, it is correct.

What does the debug log say (try M-x mu4e-toggle-logging) when you try to "trash" the messages? It should look something like this:

2023-10-03 19:20:18.734 -> (mkdir :path "/home/djcb/Maildir/trash" :update nil) 2023-10-03 19:20:18.734 -> (move :docid 98693 :msgid nil :flags "+T-N" :maildir "/trash" :rename nil :no-view nil)

=> Could you please let me know where I can find the log message?

Also ensure mbsync is not running in the mean time, and turn off showing related messages. => Could you please let me know how to stop running "mbsync" ?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

--

Sangkook Choi Professor

School of Computational Sciences Korea Institute for Advanced Study (KIAS) @.*** +82-2-958-2633 https://sites.google.com/view/sangkookchoi

djcb commented 1 year ago

There's *mu4e-log* buffer (after toggling it). Or use the $ keybinding. And you can use

  (setq mu4e-get-mail-command "true")

temporarily (so mbsync won't run).

sangkookchoi commented 1 year ago

Below is the log for "d" when I use "gmail" context

2023-10-04 17:27:11.457 -> (find :query "flag:unread AND NOT flag:trashed" :threads nil :sortfield :date :descending t :maxnum 500 :skip-dups nil :include-related nil) 2023-10-04 17:27:11.461 Received 4096 byte(s) 2023-10-04 17:27:11.462 <- (:erase t) 2023-10-04 17:27:11.463 Received 4096 byte(s) 2023-10-04 17:27:11.464 * Received 2121 byte(s) 2023-10-04 17:27:11.465 <- (:headers ((:path /Users/xxxxx/.maildir/gmail/Archive/cur/1696454648.60512_5.xxxxx-laptop,U=39255:2, :size 81567 :reply-to ((:email reply-2900014-11_HTML-572570180-10973357-3384@link.adidas.com :name adidas)) :changed (25885 55307 0) :date (25885 55183 0) :from ((:email adidas@us-news.adidas.com :name adidas)) :list 10958454.xt.local :message-id 1a86e78e-aba2-4884-ac0b-9a1669f2fc5e@ind1s01mta1401.xt.local :priority normal :subject Fleece has arrived Shop all your cozy, fashion essentials right here :to ((:email xxxxx@gmail.com)) :maildir /gmail/Archive :flags (unread list personal) :docid 118585 :meta (:path :level 0 :date :data-tstamp (0 0 0))) (:path /Users/xxxxx/.maildir/gmail/Archive/cur/1696454648.60512_4.xxxxx-laptop,U=39254:2, :size 61939 :changed (25885 55307 0) :date (25885 54657 0) :from ((:email susan4352rob@gmail.com :name yhqg sajd)) :message-id CAN235SdzyGLp0n_Yhh6ny983fwkSKaxQeJjWbdKr=T2OcZZndQ@mail.gmail.com :priority low :subject dipw saghwkq hdasi xnww Re: EG0hKpnpysF0 :to ((:email xxxxx@gmail.com)) :maildir /gmail/Archive :flags (unread personal) :docid 118584 :meta (:path :level 0 :date :data-tstamp (0 0 0))) (:path /Users/xxxxx/.maildir/gmail/Trash/new/1696431433.33990_1.xxxxx-laptop,U=2610:2, :size 232723 :reply-to ((:email no-reply@digital.costco.com)) :changed (25885 32073 0) :date (25885 30785 0) :from ((:email Costco@digital.costco.com :name Costco Wholesale)) :message-id 4F.7C.39019.2487D156@outbound-mta-e797f9ae8ca846a8b3af38d1da64c50b-va7 :priority normal :subject Take the Guess out of Gifting - Shop Gift Cards and Tickets Today! :to ((:email xxxxx@gmail.com)) :maildir /gmail/Trash :flags (new unread personal) :docid 118555 :meta (:path :level 0 :date :data-tstamp (0 0 0))) (:path /Users/xxxxx/.maildir/gmail/Trash/new/1696429499.30743_1.xxxxx-laptop,U=2592:2, :size 59122 :reply-to ((:email reply-fec1157373660d74-26_HTML-91809170-514007132-11065@e.thenorthface.com :name The North Face Automated Replies)) :changed (25885 30139 0) :date (25885 25468 0) :from ((:email reply@e.thenorthface.com :name The North Face)) :list 514002129.xt.local :message-id 50d63557-4728-4845-ae3d-38b14fc2a5b0@atl1s11mta457.xt.local :priority normal :subject Explore new terrain with Summit Series :to ((:email xxxxx@gmail.com)) :maildir /gmail/Trash :flags (new unread list personal) :docid 118535 :meta (:path :level 0 :date :data-tstamp (0 0 0))) (:path /Users/xxxxx/.maildir/gmail/Trash/new/1696429499.30743_2.xxxxx-laptop,U=2593:2, :size 15113 :changed (25885 30139 0) :date (25885 25026 0) :from ((:email no-reply@zoom.us :name Zoom)) :message-id sh0VXmAzQtmje8AUu7bNjw@geopod-ismtpd-11 :priority normal :subject Mancheon Han has joined your Personal Meeting Room :to ((:email xxxxx@gmail.com)) :maildir /gmail/Trash :flags (new unread personal) :docid 118537 :meta (:path :level 0 :date :data-tstamp (0 0 0))) (:path /Users/xxxxx/.maildir/gmail/Trash/new/1696429499.30743_3.xxxxx-laptop,U=2594:2, :size 111750 :reply-to ((:email nytdirect@nytimes.com)) :changed (25885 30139 0) :date (25885 17121 0) :from ((:email nytdirect@nytimes.com :name The New York Times)) :list nyt.1.3.sparkpostmail.com :message-id 4C.0D.34752.6934D156@gj.mta2vrest.cc.prd.sparkpost :priority normal :subject The Morning: The Speaker is fired :to ((:email xxxxx@gmail.com)) :maildir /gmail/Trash :flags (new unread list personal) :docid 118539 :meta (:path :level 0 :date :data-tstamp (0 0 0))) (:path /Users/xxxxx/.maildir/gmail/Trash/new/1696429499.30743_4.xxxxx-laptop,U=2595:2, :size 416008 :changed (25885 30139 0) :date (25885 15886 0) :from ((:email newsletter@hibrain.net)) :message-id 20231004000092491102.20231004000092354101@email.ncloud.com :priority normal :subject [하이브레인넷 990호] 강사법 시행 4년 … 교수 줄고 강사 및 기타 비전임 증가·강사 처우는 제자리 :to ((:email xxxxx@gmail.com)) :maildir /gmail/Trash :flags (new unread personal) :docid 118540 :meta (:path :level 0 :date :data-tstamp (0 0 0))) (:path /Users/xxxxx/.maildir/gmail/Trash/new/1696429500.30743_5.xxxxx-laptop,U=2596:2, :size 7211 :reply-to ((:email xxxxx@gmail.com :name xxxxx)) :changed (25885 30140 0) :date (25885 12695 0) :from ((:email calendar-notification@google.com :name Google Calendar)) :message-id calendar-76db093b-3e81-423f-8d08-e6ad79825f39@google.com :priority normal :subject You have no events scheduled today. :to ((:email xxxxx@gmail.com :name xxxxx)) :maildir /gmail/Trash :flags (new unread personal) :docid 118536 :meta (:path :level 0 :date :data-tstamp (0 0 0))) (:path /Users/xxxxx/.maildir/gmail/Trash/new/1696429500.30743_6.xxxxx-laptop,U=2597:2, :size 141129 :reply-to ((:email reply-5200040-17_HTML-1821964888-10665194-33401@engage.xbox.com :name Xbox)) :changed (25885 30140 0) :date (25884 64504 0) :from ((:email xboxreps@engage.xbox.com :name Xbox)) :list 10664859.xt.local :message-id 81e088cf-9b9f-48a9-a4be-990ca39a7494@ind1s01mta784.xt.local :priority normal :subject Take in all the top highlights from Tokyo Game Show! :to ((:email xxxxx@gmail.com)) :maildir /gmail/Trash :flags (new unread list personal) :docid 118538 :meta (:path :level 0 :date :data-tstamp (0 0 0))) (:path /Users/xxxxx/.maildir/gmail/Trash/new/1696429554.30825_1.xxxxx-laptop,U=2598:2, :size 18102 :changed (25885 30194 0) :date (25884 56041 0) :from ((:email do-not-reply@seesaw.me :name Seesaw)) :message-id 20231004032425.8cdf17ed87d270bf@seesaw.me :priority normal :subject New Message from Melissa Keith :to ((:email xxxxx@gmail.com)) :maildir /gmail/Trash :flags (new unread personal) :docid 118543 :meta (:path :level 0 :date :data-tstamp (0 0 0))) (:path /Users/xxxxx/.maildir/gmail/Trash/new/1696429554.30825_2.xxxxx-laptop,U=2599:2, :size 60000 :changed (25885 30194 0) :date (25884 51897 0) :from ((:email noreply@redditmail.com :name Reddit)) :message-id 0100018af877e323-203ad7a6-a6a7-41fe-888c-1bb0b4d2ae61-000000@email.amazonses.com :priority normal :subject "Notion like tree viewer for notes" :to ((:email xxxxx@gmail.com)) :maildir /gmail/Trash :flags (new unread personal) :docid 118547 :meta (:path :level 0 :date :data-tstamp (0 0 0))) (:path /Users/xxxxx/.maildir/gmail/Trash/new/1696429554.30825_3.xxxxx-laptop,U=2600:2, :size 26851 :changed (25885 30194 0) :date (25884 45155 0) :flags (new unread) :from ((:email verify@x.com :name X)) :message-id ED.A5.26689.360BC156@x.com :priority normal :subject New login to X from SafariMobileIos on iPhone :to ((:email inyeongwa@gmail.com :name temp)) :maildir /gmail/Trash :docid 118545 :meta (:path :level 0 :date :data-tstamp (0 0 0))) (:path /Users/xxxxx/.maildir/gmail/Trash/new/1696429554.30825_4.xxxxx-laptop,U=2601:2, :size 57918 :reply-to ((:email us9-84371173ee-df591e3484@inbound.mailchimpapp.net)) :changed (25885 30194 0) :date (25884 35855 0) :from ((:email no-reply@f45training.com :name F45 Training HQ)) :list add360be2d9fd662dd0076e95.568265.list-id.mcsv.net :message-id add360be2d9fd662dd0076e95.17b731cd77.20231003214741.58410c3847.8c54485a@mail30.atl71.mcdlv.net :priority low :subject Your Weekly F45 Training Newsletter 💪 :to ((:email xxxxx@gmail.com :name Xxxxxkook)) :maildir /gmail/Trash :flags (new unread list personal) :docid 118546 :meta (:path :level 0 :date :data-tstamp (0 0 0))) (:path /Users/xxxxx/.maildir/gmail/Trash/new/1696429555.30825_5.xxxxx-laptop,U=2602:2, :size 51288 :reply-to ((:email reply-fec4177474600c7a-257_HTML-382780116-518000498-9609@emails.underarmour.com :name Under Armour)) :changed (25885 30195 0) :date (25884 4240 0) :from ((:email underarmour@emails.underarmour.com :name UA Rewards)) :list 518000448.xt.local :message-id 925fa52f-5cdf-45c6-8a01-f570ff805d92@atl1s07mta1497.xt.local :priority normal :subject EARLY ACCESS: ColdGear® Warmth without the weight 🔥 :to ((:email xxxxx@gmail.com)) :maildir /gmail/Trash :flags (new unread list personal) :docid 118542 :meta (:path :level 0 :date :data-tstamp (0 0 0))) (:path /Users/xxxxx/.maildir/gmail/Trash/new/1696429555.30825_6.xxxxx-laptop,U=2603:2, :size 15115 :changed (25885 30195 0) :date (25884 4178 0) :from ((:email no-reply@zoom.us :name Zoom)) :message-id TkKSQvfZTtGzbPw4StYVow@geopod-ismtpd-14 :priority normal :subject Taehee Ko has joined your Personal Meeting Room :to ((:email xxxxx@gmail.com)) :maildir /gmail/Trash :flags (new unread personal) :docid 118544 :meta (:path :level 0 :date :data-tstamp (0 0 0))) (:path /Users/xxxxx/.maildir/gmail/Trash/new/1696429555.30825_7.xxxxx-laptop,U=2604:2, :size 110842 :reply-to ((:email nytdirect@nytimes.com)) :changed (25885 30195 0) :date (25883 61313 0) :from ((:email nytdirect@nytimes.com :name The New York Times)) :list nyt.1.3.sparkpostmail.com :message-id FC.2E.21080.921FB156@gc.mta2vrest.cc.prd.sparkpost :priority normal :subject The Morning: Today at the Supreme Court :to ((:email xxxxx@gmail.com)) :maildir /gmail/Trash :flags (new unread list personal) :docid 118548 :meta (:path :level 0 :date :data-tstamp (0 0 0))) (:path /Users/xxxxx/.maildir/gmail/Trash/new/1696429555.30825_8.xxxxx-laptop,U=2605:2, :size 43566 :reply-to ((:email reply-fe8a15747d6d06797c-267_HTML-124603743-100031849-23009@emails.nationalgridus.com :name National Grid USA Service Company)) :changed (25885 30195 0) :date (25883 9429 0) :from ((:email nationalgrid@emails.nationalgridus.com :name National Grid)) :list 100011295.xt.local :message-id be438146-f949-4975-a92b-c7b61e91c46d@dfw1s10mta585.xt.local :priority normal :subject Save with energy-efficient solutions for your home. :to ((:email xxxxx@gmail.com)) :maildir /gmail/Trash :flags (new unread list personal) :docid 118541 :meta (:path :level 0 :date :data-tstamp (0 0 0))))) 2023-10-04 17:27:11.466 <- (:found 17)

djcb commented 1 year ago

Hmm, I see the results of a search query, but the critical part is the 'move' as in my example earlier; i.e., do your d (mark for trash) and x and show the logging output of that. It should start with (move .... . Thanks.

sangkookchoi commented 1 year ago

Hi, Thanks for your help. please see below. I deleted emails with "gmail" context.


2023-10-06 12:17:23.056 <- (:found 40) 2023-10-06 12:17:28.774 -> (mkdir :path "/Users/xxxxx/.maildir/gmail/Trash" :update nil) 2023-10-06 12:17:28.774 -> (move :docid 118770 :msgid nil :flags "+T-N" :maildir "/gmail/Trash" :rename t :no-view nil) 2023-10-06 12:17:28.774 -> (mkdir :path "/Users/xxxxx/.maildir/gmail/Trash" :update nil) 2023-10-06 12:17:28.774 -> (move :docid 118758 :msgid nil :flags "+T-N" :maildir "/gmail/Trash" :rename t :no-view nil) 2023-10-06 12:17:28.858 Received 2332 byte(s) 2023-10-06 12:17:28.858 <- (:update (:size 51134 :reply-to ((:email reply-fec4157373600c78-16_HTML-91809170-514007132-27111@e.thenorthface.com :name The North Face Automated Replies)) :date (25888 1928 0) :from ((:email reply@e.thenorthface.com :name The North Face)) :list 514002129.xt.local :message-id e2529299-f775-429f-9e0c-d34b4ab1f9b9@atl1s11mta457.xt.local :priority normal :subject 30% off ThermoBall is here :to ((:email xxxxx@gmail.com)) :path /Users/xxxxx/.maildir/gmail/Trash/cur/1696609048.17b8583ca9b0a7bc.sang-laptop.lan:2,T :changed (25888 13080 0) :flags (trashed unread list personal) :maildir /gmail/Trash :docid 118770) :move t :maybe-view t) 2023-10-06 12:17:28.859 <- (:update (:size 51134 :reply-to ((:email reply-fec4157373600c78-16_HTML-91809170-514007132-27111@e.thenorthface.com :name The North Face Automated Replies)) :date (25888 1928 0) :from ((:email reply@e.thenorthface.com :name The North Face)) :list 514002129.xt.local :message-id e2529299-f775-429f-9e0c-d34b4ab1f9b9@atl1s11mta457.xt.local :priority normal :subject 30% off ThermoBall is here :to ((:email xxxxx@gmail.com)) :path /Users/xxxxx/.maildir/gmail/Trash/cur/1696609048.17b8583ca9b0a7bc.sang-laptop.lan:2,T :changed (25888 13080 0) :flags (trashed unread list personal) :maildir /gmail/Trash :docid 118771) :move t) 2023-10-06 12:17:28.859 <- (:update (:size 15125 :date (25888 1218 0) :from ((:email no-reply@zoom.us :name Zoom)) :message-id 8x7ErdT2TJSFKkojBfatlw@geopod-ismtpd-21 :priority normal :subject Minsung Kim has joined your Personal Meeting Room :to ((:email xxxxx@gmail.com)) :path /Users/xxxxx/.maildir/gmail/Trash/cur/1696609048.5ce22baea9b13ae4.sang-laptop.lan:2,T :changed (25888 13080 0) :flags (trashed unread personal) :maildir /gmail/Trash :docid 118758) :move t :maybe-view t) 2023-10-06 12:17:28.859 <- (:update (:size 15125 :date (25888 1218 0) :from ((:email no-reply@zoom.us :name Zoom)) :message-id 8x7ErdT2TJSFKkojBfatlw@geopod-ismtpd-21 :priority normal :subject Minsung Kim has joined your Personal Meeting Room :to ((:email xxxxx@gmail.com)) :path /Users/xxxxx/.maildir/gmail/Trash/cur/1696609048.5ce22baea9b13ae4.sang-laptop.lan:2,T :changed (25888 13080 0) :flags (trashed unread personal) :maildir /gmail/Trash :docid 118759) :move t) 2023-10-06 12:17:29.362 -> (find :query "flag:unread AND NOT flag:trashed" :threads nil :sortfield :date :descending t :maxnum 500 :skip-dups nil :include-related nil) 2023-10-06 12:17:29.401 -> (queries :queries (maildir:/gmail/INBOX OR maildir:/icloud/INBOX" maildir:/gmail/Sent OR maildir:/icloud/Sent" maildir:/gmail/Drafts OR maildir:/icloud/Drafts" maildir:/gmail/Archive OR maildir:/icloud/Archive" maildir:/gmail/Junk OR maildir:/icloud/Junk" maildir:/gmail/Trash OR maildir:/icloud/Trash" "date:today..now" "date:7d..now" "maildir:\"/gmail/Archive\"" "maildir:\"/icloud/Archive\"")) 2023-10-06 12:17:29.472 Received 4096 byte(s) 2023-10-06 12:17:29.472 <- (:erase t)

In addition, I found another behavior, which might be useful. Whenever I got email in my gmail account, I can find them in both "inbox" and "archive"

djcb commented 1 year ago

Okay, so the move-to-trash works as expected, it's just that you get the messages in both folders because of mbsync; that solves the mystery. I guess you could tell mbsync to ignore certain folders.

(it's a common confusion, since Gmail as "virtual " folders (like mu queries), so messages can appear in multiple folders; when you mbsync those, you get copies).

Closing, thanks.