Function: imap-message-copy

imap-message-copy is a byte-compiled function defined in imap.el.gz.

Signature

(imap-message-copy ARTICLES MAILBOX &optional DONT-CREATE NO-COPYUID BUFFER)

Documentation

Copy ARTICLES to MAILBOX on server in BUFFER.

ARTICLES is a string message set. Create mailbox if it doesn't exist, unless DONT-CREATE is non-nil. On success, return a list with the UIDVALIDITY of the mailbox the article(s) was copied to as the first element. The rest of list contains the saved articles' UIDs.

Source Code

;; Defined in /usr/src/emacs/lisp/net/imap.el.gz
(defun imap-message-copy (articles mailbox
				   &optional dont-create no-copyuid buffer)
  "Copy ARTICLES to MAILBOX on server in BUFFER.
ARTICLES is a string message set.  Create mailbox if it doesn't exist,
unless DONT-CREATE is non-nil.  On success, return a list with
the UIDVALIDITY of the mailbox the article(s) was copied to as the
first element.  The rest of list contains the saved articles' UIDs."
  (when articles
    (with-current-buffer (or buffer (current-buffer))
      (let ((mailbox (imap-utf7-encode mailbox)))
	(if (let ((cmd (concat "UID COPY " articles " \"" mailbox "\""))
		  (imap-current-target-mailbox mailbox))
	      (if (imap-ok-p (imap-send-command-wait cmd))
		  t
		(when (and (not dont-create)
			   ;; removed because of buggy Oracle server
			   ;; that doesn't send TRYCREATE tags (which
			   ;; is a MUST according to specifications):
			   ;;(imap-mailbox-get-1 'trycreate mailbox)
			   (imap-mailbox-create-1 mailbox))
		  (imap-ok-p (imap-send-command-wait cmd)))))
	    (or no-copyuid
		(imap-message-copyuid-1 mailbox)))))))