diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index c0b3591..a4d47f6 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -1562,31 +1562,42 @@ When called non-interactively, optional second argument NEW-WINDOW is used instead of `browse-url-new-window-flag'." (interactive (browse-url-interactive-arg "Mailto URL: ")) (save-excursion - (let* ((alist (rfc2368-parse-mailto-url url)) - (to (assoc "To" alist)) - (subject (assoc "Subject" alist)) - (body (assoc "Body" alist)) - (rest (delq to (delq subject (delq body alist)))) - (to (cdr to)) - (subject (cdr subject)) - (body (cdr body)) - (mail-citation-hook (unless body mail-citation-hook))) - (if (browse-url-maybe-new-window new-window) - (compose-mail-other-window to subject rest nil - (list 'insert-buffer (current-buffer))) - (compose-mail to subject rest nil nil - (list 'insert-buffer (current-buffer)))) - (when body - (goto-char (point-min)) - (unless (or (search-forward (concat "\n" mail-header-separator "\n") - nil 'move) - (bolp)) - (insert "\n")) - (goto-char (prog1 - (point) - (insert (replace-regexp-in-string "\r\n" "\n" body)) - (unless (bolp) - (insert "\n")))))))) + (let ((headers (rfc2368-parse-mailto-url url)) + to subject body attaches rest) + (dolist (header headers) + (cond + ((equal (car header) "To") + (setq to (cdr header))) + ((equal (car header) "Subject") + (setq subject (cdr header))) + ((equal (car header) "Body") + (setq body (cdr header))) + ((equal (car header) "Attach") + (add-to-list 'attaches (cdr header))) + (t + (push header rest)))) + (let ((mail-citation-hook (unless body mail-citation-hook))) + (if (browse-url-maybe-new-window new-window) + (compose-mail-other-window to subject rest nil + (list 'insert-buffer (current-buffer))) + (compose-mail to subject rest nil nil + (list 'insert-buffer (current-buffer)))) + (when body + (goto-char (point-min)) + (unless (or (search-forward (concat "\n" mail-header-separator "\n") + nil 'move) + (bolp)) + (insert "\n")) + (goto-char (prog1 + (point) + (insert (replace-regexp-in-string "\r\n" "\n" body)) + (unless (bolp) + (insert "\n"))))) + (when attaches + (if (not mml-mode) + (error "Enable MML mode if you want to attach files") + (dolist (attach attaches) + (mml-attach-file attach nil nil "attachment")))))))) ;; --- Random browser ---