Function: mime-to-mml

mime-to-mml is a byte-compiled function defined in mml.el.gz.

Signature

(mime-to-mml &optional HANDLES)

Documentation

Translate the current buffer (which should be a message) into MML.

If HANDLES is non-nil, use it instead reparsing the buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/mml.el.gz
(defun mime-to-mml (&optional handles)
  "Translate the current buffer (which should be a message) into MML.
If HANDLES is non-nil, use it instead reparsing the buffer."
  ;; First decode the head.
  (save-restriction
    (message-narrow-to-head)
    (let ((rfc2047-quote-decoded-words-containing-tspecials t))
      (mail-decode-encoded-word-region (point-min) (point-max))))
  (unless handles
    (setq handles (mm-dissect-buffer t)))
  (goto-char (point-min))
  (if (search-forward "\n\n" nil 'move)
      (delete-region (point) (point-max))
    ;; No content in the part that is the sole part of this message.
    (insert (if (bolp) "\n" "\n\n")))
  (if (stringp (car handles))
      (mml-insert-mime handles)
    (mml-insert-mime handles t))
  (mm-destroy-parts handles)
  (save-restriction
    (message-narrow-to-head)
    ;; Remove them, they are confusing.
    (message-remove-header "Content-Type")
    (message-remove-header "MIME-Version")
    (message-remove-header "Content-Disposition")
    (message-remove-header "Content-Transfer-Encoding")))