Function: mail-setup
mail-setup is a byte-compiled function defined in sendmail.el.gz.
Signature
(mail-setup TO SUBJECT IN-REPLY-TO CC REPLYBUFFER ACTIONS RETURN-ACTION)
Source Code
;; Defined in /usr/src/emacs/lisp/mail/sendmail.el.gz
(defun mail-setup (to subject in-reply-to cc replybuffer
actions return-action)
(or mail-default-reply-to
(setq mail-default-reply-to (getenv "REPLYTO")))
(sendmail-sync-aliases)
(when (eq mail-aliases t)
(setq mail-aliases nil)
(and mail-personal-alias-file
(file-exists-p mail-personal-alias-file)
(build-mail-aliases)))
;; Don't leave this around from a previous message.
(kill-local-variable 'buffer-file-coding-system)
;; This doesn't work for enable-multibyte-characters.
;; (kill-local-variable 'enable-multibyte-characters)
(set-buffer-multibyte t)
(if current-input-method
(deactivate-input-method))
;; Local variables for Mail mode.
(setq mail-send-actions actions)
(setq mail-reply-action replybuffer)
(setq mail-return-action return-action)
(goto-char (point-min))
(if mail-setup-with-from
(mail-insert-from-field))
(insert "To: ")
(save-excursion
(if to
;; Here removed code to extract names from within <...>
;; on the assumption that mail-strip-quoted-names
;; has been called and has done so.
(let ((fill-prefix "\t")
(address-start (point)))
(insert to "\n")
(fill-region-as-paragraph address-start (point-max))
(goto-char (point-max))
(unless (bolp)
(newline)))
(newline))
(if cc
(let ((fill-prefix "\t")
(address-start (progn (insert "Cc: ") (point))))
(insert cc "\n")
(fill-region-as-paragraph address-start (point-max))
(goto-char (point-max))
(unless (bolp)
(newline))))
(if in-reply-to
(let ((fill-prefix "\t")
(fill-column 78)
(address-start (point)))
(insert "In-Reply-To: " in-reply-to "\n")
(fill-region-as-paragraph address-start (point-max))
(goto-char (point-max))
(unless (bolp)
(newline))))
(insert "Subject: " (or subject "") "\n")
(if mail-default-headers
(insert mail-default-headers))
(if mail-default-reply-to
(insert "Reply-To: " mail-default-reply-to "\n"))
(if mail-self-blind
(insert "Bcc: " user-mail-address "\n"))
(if mail-archive-file-name
(insert "Fcc: " mail-archive-file-name "\n"))
(put-text-property (point)
(progn
(insert mail-header-separator "\n")
(1- (point)))
'category 'mail-header-separator)
;; Insert the signature. But remember the beginning of the message.
(if to (setq to (point)))
(if mail-signature (mail-signature t))
(goto-char (point-max))
(or (bolp) (newline)))
(if to (goto-char to))
(or to subject in-reply-to
(set-buffer-modified-p nil))
(run-hooks 'mail-setup-hook))