- (std11-field-body "Bcc")
- (std11-field-body "Newsgroups"))
- (erase-buffer)
- (set-buffer-multibyte t)
- (insert-file-contents location)
- (goto-char (point-min))
- (insert "Content-Type: "
- (or (cdr (elmo-string-matched-assoc
- location
- elmo-nmz-content-type-alist))
- "text/plain")
- "; charset=ISO-2022-JP\nMIME-Version: 1.0\n\n")
- (encode-coding-region (point-min) (point-max)
- (mime-charset-to-coding-system "ISO-2022-JP"))
- (set-buffer-multibyte nil))))
+ (std11-field-body "Subject"))
+ (let (charset guess uid)
+ (erase-buffer)
+ (set-buffer-multibyte t)
+ (insert-file-contents location)
+ (setq charset (detect-mime-charset-region (point-min)
+ (point-max)))
+ (goto-char (point-min))
+ (setq guess (mime-find-file-type location))
+ (setq uid (nth 2 (file-attributes location)))
+ (insert "From: " (concat (user-full-name uid)
+ " <"(user-login-name uid) "@"
+ (system-name) ">") "\n")
+ (insert "Subject: " location "\n")
+ (insert "Content-Type: "
+ (concat (nth 0 guess) "/" (nth 1 guess))
+ "; charset=" (upcase (symbol-name charset))
+ "\nMIME-Version: 1.0\n\n")
+ (encode-mime-charset-region (point-min) (point-max) charset)
+ (set-buffer-multibyte nil)))))