aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/mail
diff options
context:
space:
mode:
authorRichard M. Stallman1995-02-01 05:47:45 +0000
committerRichard M. Stallman1995-02-01 05:47:45 +0000
commit92bde7a2279f1fdb8944d83b0efdbb92f7c32afb (patch)
treee97acefe8876c5555a43b957849624dc470e266e /lisp/mail
parentb498c415e026e2ad0b6bc56289ee04bc37da416b (diff)
downloademacs-92bde7a2279f1fdb8944d83b0efdbb92f7c32afb.tar.gz
emacs-92bde7a2279f1fdb8944d83b0efdbb92f7c32afb.zip
(rmail-retry-failure): Handle "Mime-encapsulated messages".
Discard return-path and from headers as well as sender.
Diffstat (limited to 'lisp/mail')
-rw-r--r--lisp/mail/rmail.el56
1 files changed, 36 insertions, 20 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 458415dc888..457b443a6a1 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -2208,25 +2208,41 @@ specifying headers which should not be copied into the new message."
2208 ;; Narrow down to just the quoted original message 2208 ;; Narrow down to just the quoted original message
2209 (rmail-beginning-of-message) 2209 (rmail-beginning-of-message)
2210 (let ((case-fold-search t)) 2210 (let ((case-fold-search t))
2211 (or (re-search-forward mail-unsent-separator nil t) 2211 (if (search-forward "This is a MIME-encapsulated message\n\n--" nil t)
2212 (error "Cannot parse this as a failure message"))) 2212 (let ((codestring
2213 (save-restriction 2213 (buffer-substring (progn (beginning-of-line) (point))
2214 (let ((old-end (point-max))) 2214 (progn (end-of-line) (point)))))
2215 ;; One message contained a few random lines before the old 2215 (re-search-forward mail-unsent-separator)
2216 ;; message header. The first line of the message started with 2216 (setq mail-buffer (current-buffer))
2217 ;; two hyphens. A blank line follows these random lines. 2217 (search-forward codestring)
2218 (skip-chars-forward "\n") 2218 (or (search-forward "\n\n" nil t)
2219 (if (looking-at "^--") 2219 (error "Cannot find end of Mime data in failed message"))
2220 (progn 2220 (setq bounce-start (point))
2221 (search-forward "\n\n") 2221 (save-excursion
2222 (skip-chars-forward "\n"))) 2222 (goto-char (point-max))
2223 (beginning-of-line) 2223 (search-backward codestring)
2224 (narrow-to-region (point) (point-max)) 2224 (setq bounce-end (point)))
2225 (setq mail-buffer (current-buffer) 2225 (or (search-forward "\n\n" nil t)
2226 bounce-start (point) 2226 (error "Cannot find end of header in failed message")))
2227 bounce-end (point-max)) 2227 (or (re-search-forward mail-unsent-separator nil t)
2228 (or (search-forward "\n\n" nil t) 2228 (error "Cannot parse this as a failure message"))
2229 (error "Cannot find end of header in failed message"))))) 2229 (save-restriction
2230 (let ((old-end (point-max)))
2231 ;; One message contained a few random lines before the old
2232 ;; message header. The first line of the message started with
2233 ;; two hyphens. A blank line follows these random lines.
2234 (skip-chars-forward "\n")
2235 (if (looking-at "^--")
2236 (progn
2237 (search-forward "\n\n")
2238 (skip-chars-forward "\n")))
2239 (beginning-of-line)
2240 (narrow-to-region (point) (point-max))
2241 (setq mail-buffer (current-buffer)
2242 bounce-start (point)
2243 bounce-end (point-max))
2244 (or (search-forward "\n\n" nil t)
2245 (error "Cannot find end of header in failed message")))))))
2230 ;; Start sending a new message; default header fields from the original. 2246 ;; Start sending a new message; default header fields from the original.
2231 ;; Turn off the usual actions for initializing the message body 2247 ;; Turn off the usual actions for initializing the message body
2232 ;; because we want to get only the text from the failure message. 2248 ;; because we want to get only the text from the failure message.
@@ -2238,7 +2254,7 @@ specifying headers which should not be copied into the new message."
2238 (insert-buffer-substring mail-buffer bounce-start bounce-end) 2254 (insert-buffer-substring mail-buffer bounce-start bounce-end)
2239 (goto-char (point-min)) 2255 (goto-char (point-min))
2240 (rmail-clear-headers rmail-retry-ignored-headers) 2256 (rmail-clear-headers rmail-retry-ignored-headers)
2241 (rmail-clear-headers "^sender:") 2257 (rmail-clear-headers "^sender:\\|^from\\|^return-path")
2242 (goto-char (point-min)) 2258 (goto-char (point-min))
2243 (save-restriction 2259 (save-restriction
2244 (search-forward "\n\n") 2260 (search-forward "\n\n")