Function: mail
mail is an autoloaded, interactive and byte-compiled function defined
in sendmail.el.gz.
Signature
(mail &optional NOERASE TO SUBJECT IN-REPLY-TO CC REPLYBUFFER ACTIONS RETURN-ACTION)
Documentation
Edit a message to be sent. Prefix arg means resume editing (don't erase).
When this function returns, the buffer *mail* is selected.
The value is t if the message was newly initialized; otherwise, nil.
Optionally, the signature file mail-signature-file can be inserted at the
end; see the variable mail-signature(var)/mail-signature(fun).
While editing message, type C-c C-c (mail-send-and-exit) to send the message and exit.
Various special commands starting with C-c are available in sendmail mode
to move to message header fields:
C-M-i mail-abbrev-complete-alias
C-M-o mail-split-line
C-c ? describe-mode
C-c C-a mail-abbrev-insert-alias
C-c C-c mail-send-and-exit
C-c C-f C-a mail-mail-reply-to
C-c C-f C-b mail-bcc
C-c C-f C-c mail-cc
C-c C-f C-d mail-insert-disposition-notification-to
C-c C-f C-f mail-fcc
C-c C-f C-l mail-mail-followup-to
C-c C-f C-r mail-reply-to
C-c C-f C-s mail-subject
C-c C-f C-t mail-to
C-c C-q mail-fill-yanked-message
C-c C-r mail-yank-region
C-c C-s mail-send
C-c C-t mail-text
C-c C-w mail-signature(var)/mail-signature(fun)
C-c C-y mail-yank-original
C-c TAB mail-insert-file
If mail-self-blind is non-nil, a Bcc to yourself is inserted
when the message is initialized.
If mail-default-reply-to is non-nil, it should be an address (a string);
a Reply-To: field with that address is inserted.
If mail-archive-file-name is non-nil, an Fcc field with that file name
is inserted.
The normal hook mail-setup-hook is run after the message is
initialized. It can add more default fields to the message.
The first argument, NOERASE, determines what to do when there is
an existing modified *mail* buffer. If NOERASE is nil, the
existing mail buffer is used, and the user is prompted whether to
keep the old contents or to erase them. If NOERASE has the value
new, a new mail buffer will be created instead of using the old
one. Any other non-nil value means to always select the old
buffer without erasing the contents.
The second through fifth arguments,
TO, SUBJECT, IN-REPLY-TO and CC, specify if non-nil
the initial contents of those header fields.
These arguments should not have final newlines.
The sixth argument REPLYBUFFER is a buffer which contains an
original message being replied to, or else an action
of the form (FUNCTION . ARGS) which says how to insert the original.
Or it can be nil, if not replying to anything.
The seventh argument ACTIONS is a list of actions to take
if/when the message is sent. Each action looks like (FUNCTION . ARGS);
when the message is sent, we apply FUNCTION to ARGS.
This is how Rmail arranges to mark messages answered.
Probably introduced at or before Emacs version 1.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/mail/sendmail.el.gz
;; Put these commands last, to reduce chance of lossage from quitting
;; in middle of loading the file.
;;;###autoload
(defun mail (&optional noerase to subject in-reply-to cc replybuffer
actions return-action)
"Edit a message to be sent. Prefix arg means resume editing (don't erase).
When this function returns, the buffer `*mail*' is selected.
The value is t if the message was newly initialized; otherwise, nil.
Optionally, the signature file `mail-signature-file' can be inserted at the
end; see the variable `mail-signature'.
\\<mail-mode-map>
While editing message, type \\[mail-send-and-exit] to send the message and exit.
Various special commands starting with C-c are available in sendmail mode
to move to message header fields:
\\{mail-mode-map}
If `mail-self-blind' is non-nil, a Bcc to yourself is inserted
when the message is initialized.
If `mail-default-reply-to' is non-nil, it should be an address (a string);
a Reply-To: field with that address is inserted.
If `mail-archive-file-name' is non-nil, an Fcc field with that file name
is inserted.
The normal hook `mail-setup-hook' is run after the message is
initialized. It can add more default fields to the message.
The first argument, NOERASE, determines what to do when there is
an existing modified `*mail*' buffer. If NOERASE is nil, the
existing mail buffer is used, and the user is prompted whether to
keep the old contents or to erase them. If NOERASE has the value
`new', a new mail buffer will be created instead of using the old
one. Any other non-nil value means to always select the old
buffer without erasing the contents.
The second through fifth arguments,
TO, SUBJECT, IN-REPLY-TO and CC, specify if non-nil
the initial contents of those header fields.
These arguments should not have final newlines.
The sixth argument REPLYBUFFER is a buffer which contains an
original message being replied to, or else an action
of the form (FUNCTION . ARGS) which says how to insert the original.
Or it can be nil, if not replying to anything.
The seventh argument ACTIONS is a list of actions to take
if/when the message is sent. Each action looks like (FUNCTION . ARGS);
when the message is sent, we apply FUNCTION to ARGS.
This is how Rmail arranges to mark messages `answered'."
(interactive "P")
(if (eq noerase 'new)
(pop-to-buffer-same-window (generate-new-buffer "*mail*"))
(and noerase
(not (get-buffer "*mail*"))
(setq noerase nil))
(pop-to-buffer-same-window "*mail*"))
;; Avoid danger that the auto-save file can't be written.
(let ((dir (expand-file-name
(file-name-as-directory mail-default-directory))))
(if (file-exists-p dir)
(setq default-directory dir)))
;; Only call auto-save-mode if necessary, to avoid changing auto-save file.
(if (or (and auto-save-default (not buffer-auto-save-file-name))
(and (not auto-save-default) buffer-auto-save-file-name))
(auto-save-mode auto-save-default))
(mail-mode)
;; Disconnect the buffer from its visited file
;; (in case the user has actually visited a file *mail*).
;; (set-visited-file-name nil)
(let (initialized)
(and (not (and noerase
(not (eq noerase 'new))))
(if buffer-file-name
(if (buffer-modified-p)
(when (y-or-n-p "Buffer has unsaved changes; reinitialize it and discard them? ")
(if (y-or-n-p "Disconnect buffer from visited file? ")
(set-visited-file-name nil))
t)
(when (y-or-n-p "Reinitialize buffer, and disconnect it from the visited file? ")
(set-visited-file-name nil)
t))
;; A non-file-visiting buffer.
(if (buffer-modified-p)
(y-or-n-p "Unsent message being composed; erase it? ")
t))
(let ((inhibit-read-only t))
(erase-buffer)
(mail-setup to subject in-reply-to cc replybuffer actions
return-action)
(setq initialized t)))
(if (and buffer-auto-save-file-name
(file-exists-p buffer-auto-save-file-name))
(message (substitute-command-keys
"Auto save file for draft message exists; consider \\[mail-recover]")))
initialized))