--- mml.el~ 2005-07-24 21:50:41 +0000 +++ mml.el 2005-07-27 01:34:21 +0000 @@ -404,11 +404,14 @@ (mml-tweak-part cont) (cond ((or (eq (car cont) 'part) (eq (car cont) 'mml)) - (let ((raw (cdr (assq 'raw cont))) - type charset coding filename encoding flowed coded) - (setq type (or (cdr (assq 'type cont)) "text/plain") - charset (cdr (assq 'charset cont)) - coding (mm-charset-to-coding-system charset)) + (let* ((raw (cdr (assq 'raw cont))) + (filename (cdr (assq 'filename cont))) + (type (or (cdr (assq 'type cont)) + (and filename (mm-default-file-encoding filename)) + "application/octet-stream")) + (charset (cdr (assq 'charset cont))) + (coding (mm-charset-to-coding-system charset)) + encoding flowed coded) (cond ((eq coding 'ascii) (setq charset nil coding nil)) @@ -421,7 +424,7 @@ (cond ((cdr (assq 'buffer cont)) (insert-buffer-substring (cdr (assq 'buffer cont)))) - ((and (setq filename (cdr (assq 'filename cont))) + ((and filename (not (equal (cdr (assq 'nofile cont)) "yes"))) (let ((coding-system-for-read coding)) (mm-insert-file-contents filename))) @@ -482,7 +485,7 @@ (insert (with-current-buffer (cdr (assq 'buffer cont)) (mm-with-unibyte-current-buffer (buffer-string))))) - ((and (setq filename (cdr (assq 'filename cont))) + ((and filename (not (equal (cdr (assq 'nofile cont)) "yes"))) (let ((coding-system-for-read mm-binary-coding-system)) (mm-insert-file-contents filename nil nil nil nil t)) @@ -527,15 +530,19 @@ "access-type=url")) (when parameters (mml-insert-parameter-string - cont '(expiration size permission)))) - (insert "\n\n") - (insert "Content-Type: " (cdr (assq 'type cont)) "\n") - (insert "Content-ID: " (message-make-message-id) "\n") - (insert "Content-Transfer-Encoding: " - (or (cdr (assq 'encoding cont)) "binary")) - (insert "\n\n") - (insert (or (cdr (assq 'contents cont)))) - (insert "\n")) + cont '(expiration size permission))) + (insert "\n\n") + (insert "Content-Type: " + (or (cdr (assq 'type cont)) + (and name (mm-default-file-encoding name)) + "application/octet-stream") + "\n") + (insert "Content-ID: " (message-make-message-id) "\n") + (insert "Content-Transfer-Encoding: " + (or (cdr (assq 'encoding cont)) "binary")) + (insert "\n\n") + (insert (or (cdr (assq 'contents cont)))) + (insert "\n"))) ((eq (car cont) 'multipart) (let* ((type (or (cdr (assq 'type cont)) "mixed")) (mml-generate-default-type (if (equal type "digest")