diff options
| author | Eli Zaretskii | 2006-11-24 14:33:19 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2006-11-24 14:33:19 +0000 |
| commit | 362e23e116123e6b2d2cfe823210348075e8ae10 (patch) | |
| tree | d376f22b147b3450a4ce368380bc27b60b8202bd | |
| parent | 4fffd73b309c5a74be1f57ce6fd60f481e8b6be8 (diff) | |
| download | emacs-362e23e116123e6b2d2cfe823210348075e8ae10.tar.gz emacs-362e23e116123e6b2d2cfe823210348075e8ae10.zip | |
(smtpmail-send-it): Copy buffer-file-coding-system from the mail buffer.
Possibly add a MIME header for the message encoding. Bind
coding-system-for-write around the call to mail-do-fcc. Use
smtpmail-code-conv-from to encode queued mail messages.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/mail/smtpmail.el | 27 |
2 files changed, 34 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 26115e5959c..1cef367ff45 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2006-11-24 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * mail/smtpmail.el (smtpmail-send-it): Copy | ||
| 4 | buffer-file-coding-system from the mail buffer. Possibly add a | ||
| 5 | MIME header for the message encoding. Bind | ||
| 6 | coding-system-for-write around the call to mail-do-fcc. Use | ||
| 7 | smtpmail-code-conv-from to encode queued mail messages. | ||
| 8 | |||
| 1 | 2006-11-24 Juanma Barranquero <lekktu@gmail.com> | 9 | 2006-11-24 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 10 | ||
| 3 | * net/rcirc.el (rcirc-buffer-maximum-lines): | 11 | * net/rcirc.el (rcirc-buffer-maximum-lines): |
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index ac87a93b7a1..271c7a76ca2 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el | |||
| @@ -244,6 +244,11 @@ This is relative to `smtpmail-queue-dir'.") | |||
| 244 | (save-excursion | 244 | (save-excursion |
| 245 | (set-buffer tembuf) | 245 | (set-buffer tembuf) |
| 246 | (erase-buffer) | 246 | (erase-buffer) |
| 247 | ;; Use the same buffer-file-coding-system as in the mail | ||
| 248 | ;; buffer, otherwise any write-region invocations (e.g., in | ||
| 249 | ;; mail-do-fcc below) will annoy with asking for a suitable | ||
| 250 | ;; encoding. | ||
| 251 | (set-buffer-file-coding-system smtpmail-code-conv-from nil t) | ||
| 247 | (insert-buffer-substring mailbuf) | 252 | (insert-buffer-substring mailbuf) |
| 248 | (goto-char (point-max)) | 253 | (goto-char (point-max)) |
| 249 | ;; require one newline at the end. | 254 | ;; require one newline at the end. |
| @@ -326,6 +331,22 @@ This is relative to `smtpmail-queue-dir'.") | |||
| 326 | (goto-char (point-min)) | 331 | (goto-char (point-min)) |
| 327 | (unless (re-search-forward "^Date:" delimline t) | 332 | (unless (re-search-forward "^Date:" delimline t) |
| 328 | (insert "Date: " (message-make-date) "\n")) | 333 | (insert "Date: " (message-make-date) "\n")) |
| 334 | ;; Possibly add a MIME header for the current coding system | ||
| 335 | (let (charset) | ||
| 336 | (goto-char (point-min)) | ||
| 337 | (and (eq mail-send-nonascii 'mime) | ||
| 338 | (not (re-search-forward "^MIME-version:" delimline t)) | ||
| 339 | (progn (skip-chars-forward "\0-\177") | ||
| 340 | (/= (point) (point-max))) | ||
| 341 | smtpmail-code-conv-from | ||
| 342 | (setq charset | ||
| 343 | (coding-system-get smtpmail-code-conv-from | ||
| 344 | 'mime-charset)) | ||
| 345 | (goto-char delimline) | ||
| 346 | (insert "MIME-version: 1.0\n" | ||
| 347 | "Content-type: text/plain; charset=" | ||
| 348 | (symbol-name charset) | ||
| 349 | "\nContent-Transfer-Encoding: 8bit\n"))) | ||
| 329 | ;; Insert an extra newline if we need it to work around | 350 | ;; Insert an extra newline if we need it to work around |
| 330 | ;; Sun's bug that swallows newlines. | 351 | ;; Sun's bug that swallows newlines. |
| 331 | (goto-char (1+ delimline)) | 352 | (goto-char (1+ delimline)) |
| @@ -334,7 +355,10 @@ This is relative to `smtpmail-queue-dir'.") | |||
| 334 | ;; Find and handle any FCC fields. | 355 | ;; Find and handle any FCC fields. |
| 335 | (goto-char (point-min)) | 356 | (goto-char (point-min)) |
| 336 | (if (re-search-forward "^FCC:" delimline t) | 357 | (if (re-search-forward "^FCC:" delimline t) |
| 337 | (mail-do-fcc delimline)) | 358 | ;; Force mail-do-fcc to use the encoding of the mail |
| 359 | ;; buffer to encode outgoing messages on FCC files. | ||
| 360 | (let ((coding-system-for-write smtpmail-code-conv-from)) | ||
| 361 | (mail-do-fcc delimline))) | ||
| 338 | (if mail-interactive | 362 | (if mail-interactive |
| 339 | (with-current-buffer errbuf | 363 | (with-current-buffer errbuf |
| 340 | (erase-buffer)))) | 364 | (erase-buffer)))) |
| @@ -370,6 +394,7 @@ This is relative to `smtpmail-queue-dir'.") | |||
| 370 | (make-directory smtpmail-queue-dir t)) | 394 | (make-directory smtpmail-queue-dir t)) |
| 371 | (with-current-buffer buffer-data | 395 | (with-current-buffer buffer-data |
| 372 | (erase-buffer) | 396 | (erase-buffer) |
| 397 | (set-buffer-file-coding-system smtpmail-code-conv-from nil t) | ||
| 373 | (insert-buffer-substring tembuf) | 398 | (insert-buffer-substring tembuf) |
| 374 | (write-file file-data) | 399 | (write-file file-data) |
| 375 | (set-buffer buffer-elisp) | 400 | (set-buffer buffer-elisp) |