Here is a way to do it using marks, which also works for bulk copying messages to another maildir. Add the following to your
;; Function to interactively prompt for a destination (minimally changed from mu4e~mark-get-move-target() )
(defun my~mark-get-copy-target ()
"Ask for a copy target, and propose to create it if it does not exist."
;; (mu4e-message-at-point) ;; raises error if there is none
(let* ((target (mu4e-ask-maildir "Copy message to: "))
(target (if (string= (substring target 0 1) "/")
(concat "/" target)))
(fulltarget (concat mu4e-maildir target)))
(when (or (file-directory-p fulltarget)
(format "%s does not exist. Create now?" fulltarget))
;; Function to duplicate a message given by its docid, msg, and that will be copied to target when the mark is executed.
(defun copy-message-to-target(docid msg target)
(new_msg_path nil) ;; local variable
(msg_flags (mu4e-message-field msg :flags))
;; 1. target is already determined interactively when executing the mark (:ask-target)
;; 2. Determine the path for the new file: we use mu4e~draft-message-filename-construct from
;; mu4e-draft.el to create a new random filename, and append the original's msg_flags
(setq new_msg_path (format "%s/%s/cur/%s" mu4e-maildir target (mu4e~draft-message-filename-construct
;; 3. Copy the message using file system call (copy-file) to new_msg_path:
;; (See e.g. mu4e-draft.el > mu4e-draft-open > resend)
(copy-file (mu4e-message-field msg :path) new_msg_path)
;; 4. Add the information to the database (may need to update current search query with 'g' if duplicating to current box. Try also 'V' to toggle the display of duplicates)
(mu4e~proc-add new_msg_path (mu4e~mark-check-target target))
;; Set this up for marking: see https://www.djcbsoftware.nl/code/mu/mu4e/Adding-a-new-kind-of-mark.html
:char ("c" . "c")
(define-key mu4e-headers-mode-map (kbd "c") 'mu4e-headers-mark-for-copy)
Now you can mark message selections in headers view for copying to another maildir by pressing 'c'. This will prompt for a destination maildir according to your setting of the variable
mu4e-maildir-shortcut. After selecting one, to execute the mark press 'x' (as usual).
if you copy messages in their own maildir, this leads to duplicated messages which may not display if
non-nil. To toggle, press 'V'.
if you copy messages in their own maildir, you also need to refresh the search by pressing 'g'