Function: hrmail--rmail-forward

hrmail--rmail-forward is an interactive and byte-compiled function defined in hrmail.el.

Signature

(hrmail--rmail-forward RESEND)

Documentation

Forward the current message to another user.

With prefix argument, RESEND the message instead of forwarding it; see the documentation of rmail-resend.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hrmail.el
(defun hrmail--rmail-forward (resend)
  "Forward the current message to another user.
With prefix argument, RESEND the message instead of forwarding it;
see the documentation of `rmail-resend'."
  (interactive "P")
  (if resend
      (call-interactively 'rmail-resend)
    (let* ((forward-buffer (current-buffer))
	   (toggle-header-flag)
	   (mime-version
	    (or (mail-fetch-field "Mime-Version")
		(progn (rmail-toggle-header)
		       (setq toggle-header-flag t)
		       nil)
		(mail-fetch-field "Mime-Version")))
	   (mime-content-type
	    (if mime-version (mail-fetch-field "Content-Type")))
	   (mime-content-encoding
	    (if mime-version (mail-fetch-field "Content-Transfer-Encoding")))
	   (subject (concat "["
			    (let ((from (or (mail-fetch-field "From")
					    (mail-fetch-field ">From"))))
			      (if from
				  (concat (mail-strip-quoted-names from) ": ")
				""))
			    (or (mail-fetch-field "Subject") "")
			    "]")))
      (if toggle-header-flag (rmail-toggle-header))
      (if mime-version (setq subject (concat subject "\nMime-Version: "
					     mime-version
					     (if mime-content-type
						 (concat "\nContent-Type: "
							 mime-content-type))
					     (if mime-content-encoding
						 (concat
						  "\nContent-Transfer-Encoding: "
						  mime-content-encoding)))))
      (save-restriction
	(Rmail-msg-widen)
	;; Turn off the usual actions for initializing the message body
	;; because we want to get only the text from the failure message.
	(let (mail-signature message-setup-hook)
	  ;; If only one window, use it for the mail buffer.
	  ;; Otherwise, use another window for the mail buffer
	  ;; so that the Rmail buffer remains visible
	  ;; and sending the mail will get back to it.
	  (if (funcall (cond ((and (not rmail-mail-new-frame) (one-window-p t))
			      'mail)
			     ((fboundp 'rmail-start-mail)
			      'rmail-start-mail)
			     (t 'mail-other-window))
		       nil nil subject nil nil nil
		       (list (list (lambda (buf msgnum)
				     (with-current-buffer buf
				       (rmail-set-attribute
					"forwarded" t msgnum)))
				   (current-buffer)
				   rmail-current-message)))
	      (save-excursion
		;; Insert after header separator--before signature if any.
		(goto-char (point-min))
		(search-forward-regexp
		 (concat "^" (regexp-quote mail-header-separator)))
		(forward-line 1)
		(insert-buffer-substring forward-buffer)
		(hmail:msg-narrow))))))))