Function: message-mail

message-mail is an interactive and byte-compiled function defined in message.el.gz.

Signature

(message-mail &optional TO SUBJECT OTHER-HEADERS CONTINUE SWITCH-FUNCTION YANK-ACTION SEND-ACTIONS RETURN-ACTION &rest _)

Documentation

Start editing a mail message to be sent.

OTHER-HEADERS is an alist of header/value pairs. CONTINUE says whether to continue editing a message already being composed. SWITCH-FUNCTION is a function used to switch to and display the mail buffer.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/message.el.gz
;;;
;;; Commands for interfacing with message
;;;

;;;###autoload
(defun message-mail (&optional to subject other-headers continue
			       switch-function yank-action send-actions
			       return-action &rest _)
  "Start editing a mail message to be sent.
OTHER-HEADERS is an alist of header/value pairs.  CONTINUE says whether
to continue editing a message already being composed.  SWITCH-FUNCTION
is a function used to switch to and display the mail buffer."
  (interactive)
  (let ((message-this-is-mail t)
	message-buffers)
    ;; Search for the existing message buffer if `continue' is non-nil.
    (if (and continue
	     (setq message-buffers (message-buffers)))
	(pop-to-buffer (car message-buffers))
      ;; Start a new buffer.
      (unless (message-mail-user-agent)
	(message-pop-to-buffer (message-buffer-name "mail" to) switch-function))
      (message-setup
       (nconc
	`((To . ,(or to "")) (Subject . ,(or subject "")))
	;; C-h f compose-mail says that headers should be specified as
	;; (string . value); however all the rest of message expects
	;; headers to be symbols, not strings (eg message-header-format-alist).
	;; https://lists.gnu.org/r/emacs-devel/2011-01/msg00337.html
	;; We need to convert any string input, eg from rmail-start-mail.
	(dolist (h other-headers other-headers)
	  (if (stringp (car h)) (setcar h (intern (capitalize (car h)))))))
       yank-action send-actions continue switch-function
       return-action))))