(interactive "P")
(gnus-summary-select-article t)
(set-buffer gnus-original-article-buffer)
- (gnus-setup-message 'compose-bounce
- (let* ((references (mail-fetch-field "references"))
- (parent (and references (gnus-parent-id references))))
- (message-bounce)
- ;; If there are references, we fetch the article we answered to.
- (and fetch parent
- (gnus-summary-refer-article parent)
- (gnus-summary-show-all-headers)))))
+ (let ((gnus-message-setup-hook '(gnus-maybe-setup-default-charset)))
+ (gnus-setup-message 'compose-bounce
+ (let* ((references (mail-fetch-field "references"))
+ (parent (and references (gnus-parent-id references))))
+ (message-bounce)
+ ;; If there are references, we fetch the article we answered to.
+ (and fetch parent
+ (gnus-summary-refer-article parent)
+ (gnus-summary-show-all-headers))))))
;;; Gcc handling.
:group 'message-interface
:type 'regexp)
+(defcustom message-bounce-setup-function 'message-bounce-setup-for-mime-edit
+ "Function to setup a re-sending bounced message."
+ :group 'message-sending
+ :type 'function)
+
;;;###autoload
(defcustom message-from-style 'default
"*Specifies how \"From\" headers look.
:group 'message-various
:type 'hook)
+(defcustom message-bounce-setup-hook nil
+ "Normal hook, run each time a a re-sending bounced message is initialized.
+The function `message-bounce' runs this hook."
+ :group 'message-various
+ :type 'hook)
+
(defcustom message-mode-hook nil
"Hook run in message mode buffers."
:group 'message-various
mime-edit-split-ignored-field-regexp)
(case-fold-search t)
failure)
- (while (string-match "Message-Id" mime-edit-split-ignored-field-regexp)
+ (while (string-match "Message-ID" mime-edit-split-ignored-field-regexp)
(setq mime-edit-split-ignored-field-regexp
(concat (substring mime-edit-split-ignored-field-regexp
0 (match-beginning 0))
(set-buffer message-edit-buffer)
(if failure
(progn
- (message "Couldn't send message via mail: %s"
- (if (eq 'error (car failure))
- (cadr failure)
- failure))
+ (message "Couldn't send message via mail: %s" failure)
nil)
(push 'mail message-sent-message-via)))))
(let ((mime-edit-split-ignored-field-regexp
mime-edit-split-ignored-field-regexp)
(case-fold-search t))
- (while (string-match "Message-Id" mime-edit-split-ignored-field-regexp)
+ (while (string-match "Message-ID" mime-edit-split-ignored-field-regexp)
(setq mime-edit-split-ignored-field-regexp
(concat (substring mime-edit-split-ignored-field-regexp
0 (match-beginning 0))
(substring mime-edit-split-ignored-field-regexp
(match-end 0)))))
(or
- (catch 'message-sending-news-done
+ (catch 'message-sending-news-failure
(mime-edit-maybe-split-and-send
(function
(lambda ()
(delete-region (match-end 0) (std11-field-end))
(insert " " (message-make-message-id))))
(unless (funcall message-send-news-function method)
- (throw 'message-sending-news-done t)))))
+ (throw 'message-sending-news-failure t)))))
nil)
(not (funcall message-send-news-function method)))))
(kill-buffer (current-buffer)))
(message "Resending message to %s...done" address)))
+(defun message-bounce-setup-for-mime-edit ()
+ (goto-char (point-min))
+ (when (search-forward (concat "\n" mail-header-separator "\n") nil t)
+ (replace-match "\n\n"))
+ (set (make-local-variable 'message-setup-hook) nil)
+ (mime-edit-again))
+
;;;###autoload
(defun message-bounce ()
"Re-mail the current message.
(message-remove-header message-ignored-bounced-headers t)
(goto-char (point-max))
(insert mail-header-separator))
+ (when message-bounce-setup-function
+ (funcall message-bounce-setup-function))
+ (run-hooks 'message-bounce-setup-hook)
(message-position-point)))
;;;