Function: rmail-resend
rmail-resend is an interactive and byte-compiled function defined in
rmail.el.gz.
Signature
(rmail-resend ADDRESS &optional FROM COMMENT MAIL-ALIAS-FILE)
Documentation
Resend current message to ADDRESSES.
ADDRESSES should be a single address, a string consisting of several addresses separated by commas, or a list of addresses.
Optional FROM is the address to resend the message from, and
defaults from the value of user-mail-address.
Optional COMMENT is a string to insert as a comment in the resent message.
Optional ALIAS-FILE is alternate aliases file to be used by sendmail,
typically for purposes of moderating a list.
Probably introduced at or before Emacs version 19.20.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/mail/rmail.el.gz
(defun rmail-resend (address &optional from comment mail-alias-file)
"Resend current message to ADDRESSES.
ADDRESSES should be a single address, a string consisting of several
addresses separated by commas, or a list of addresses.
Optional FROM is the address to resend the message from, and
defaults from the value of `user-mail-address'.
Optional COMMENT is a string to insert as a comment in the resent message.
Optional ALIAS-FILE is alternate aliases file to be used by sendmail,
typically for purposes of moderating a list."
(interactive "sResend to: ")
(require 'sendmail)
(require 'mailalias)
(unless (or (eq rmail-view-buffer (current-buffer))
(eq rmail-buffer (current-buffer)))
(error "Not an Rmail buffer"))
(if (not from) (setq from user-mail-address))
(let ((tembuf (generate-new-buffer " sendmail temp"))
(case-fold-search nil)
(mail-personal-alias-file
(or mail-alias-file mail-personal-alias-file))
(mailbuf rmail-buffer))
(unwind-protect
(with-current-buffer tembuf
;;>> Copy message into temp buffer
(if (and rmail-enable-mime
rmail-insert-mime-resent-message-function)
(funcall rmail-insert-mime-resent-message-function mailbuf)
(insert-buffer-substring mailbuf))
(goto-char (point-min))
;; Delete any Sender field, since that's not specifiable.
; Only delete Sender fields in the actual header.
(re-search-forward "^$" nil 'move)
; Using "while" here rather than "if" because some buggy mail
; software may have inserted multiple Sender fields.
(while (re-search-backward "^Sender:" nil t)
(let (beg)
(setq beg (point))
(forward-line 1)
(while (looking-at "[ \t]")
(forward-line 1))
(delete-region beg (point))))
; Go back to the beginning of the buffer so the Resent- fields
; are inserted there.
(goto-char (point-min))
;;>> Insert resent-from:
(insert "Resent-From: " from "\n")
(insert "Resent-Date: " (mail-rfc822-date) "\n")
;;>> Insert resent-to: and bcc if need be.
(let ((before (point)))
(if mail-self-blind
(insert "Resent-Bcc: " (user-login-name) "\n"))
(insert "Resent-To: " (if (stringp address)
address
(mapconcat 'identity address ",\n\t"))
"\n")
;; Expand abbrevs in the recipients.
(save-excursion
(if (featurep 'mailabbrev)
(let ((end (point-marker))
(local-abbrev-table mail-abbrevs)
(old-syntax-table (syntax-table)))
(if (and (not (vectorp mail-abbrevs))
(file-exists-p mail-personal-alias-file))
(build-mail-abbrevs))
(unless mail-abbrev-syntax-table
(mail-abbrev-make-syntax-table))
(set-syntax-table mail-abbrev-syntax-table)
(goto-char before)
(while (and (< (point) end)
(progn (forward-word-strictly 1)
(<= (point) end)))
(expand-abbrev))
(set-syntax-table old-syntax-table))
(expand-mail-aliases before (point)))))
;;>> Set up comment, if any.
(if (and (sequencep comment) (not (zerop (length comment))))
(let ((before (point))
after)
(insert comment)
(or (eolp) (insert "\n"))
(setq after (point))
(goto-char before)
(while (< (point) after)
(insert "Resent-Comment: ")
(forward-line 1))))
;; Don't expand aliases in the destination fields
;; of the original message.
(let (mail-aliases)
(funcall send-mail-function)))
(kill-buffer tembuf))
(with-current-buffer rmail-buffer
(rmail-set-attribute rmail-resent-attr-index t rmail-current-message))))