diff options
| author | Eli Zaretskii | 2001-12-21 12:06:21 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2001-12-21 12:06:21 +0000 |
| commit | 7e3fa9f5e2e3f1e9dec472b7020861b613498c96 (patch) | |
| tree | 04c85cd7302b5f1775818f05f9d47616a5cdc63d | |
| parent | 966bda3ad5207fd2f88ba681019b8d37fd2a05e7 (diff) | |
| download | emacs-7e3fa9f5e2e3f1e9dec472b7020861b613498c96.tar.gz emacs-7e3fa9f5e2e3f1e9dec472b7020861b613498c96.zip | |
(smtpmail-send-queued-mail): Use
with-temp-buffer instead of find-file-noselect, and bind
coding-system-for-read to no-conversion when reading the queued
messages. From Simon Josefsson <jas@extundo.com>.
| -rw-r--r-- | lisp/mail/smtpmail.el | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index a24aae74bf0..70376e0bf71 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el | |||
| @@ -367,11 +367,11 @@ This is relative to `smtpmail-queue-dir'.") | |||
| 367 | (defun smtpmail-send-queued-mail () | 367 | (defun smtpmail-send-queued-mail () |
| 368 | "Send mail that was queued as a result of setting `smtpmail-queue-mail'." | 368 | "Send mail that was queued as a result of setting `smtpmail-queue-mail'." |
| 369 | (interactive) | 369 | (interactive) |
| 370 | ;;; Get index, get first mail, send it, get second mail, etc... | 370 | (with-temp-buffer |
| 371 | (let ((buffer-index (find-file-noselect smtpmail-queue-index)) | 371 | ;;; Get index, get first mail, send it, update index, get second |
| 372 | (file-msg "") | 372 | ;;; mail, send it, etc... |
| 373 | (tembuf nil)) | 373 | (let ((file-msg "")) |
| 374 | (with-current-buffer buffer-index | 374 | (insert-file-contents smtpmail-queue-index) |
| 375 | (beginning-of-buffer) | 375 | (beginning-of-buffer) |
| 376 | (while (not (eobp)) | 376 | (while (not (eobp)) |
| 377 | (setq file-msg (buffer-substring (point) (line-end-position))) | 377 | (setq file-msg (buffer-substring (point) (line-end-position))) |
| @@ -379,20 +379,18 @@ This is relative to `smtpmail-queue-dir'.") | |||
| 379 | ;; Insert the message literally: it is already encoded as per | 379 | ;; Insert the message literally: it is already encoded as per |
| 380 | ;; the MIME headers, and code conversions might guess the | 380 | ;; the MIME headers, and code conversions might guess the |
| 381 | ;; encoding wrongly. | 381 | ;; encoding wrongly. |
| 382 | (setq tembuf (find-file-noselect file-msg nil t)) | 382 | (with-temp-buffer |
| 383 | (if (not (null smtpmail-recipient-address-list)) | 383 | (let ((coding-system-for-read 'no-conversion)) |
| 384 | (if (not (smtpmail-via-smtp smtpmail-recipient-address-list | 384 | (insert-file-contents file-msg)) |
| 385 | tembuf)) | 385 | (if (not (null smtpmail-recipient-address-list)) |
| 386 | (error "Sending failed; SMTP protocol error")) | 386 | (if (not (smtpmail-via-smtp smtpmail-recipient-address-list |
| 387 | (error "Sending failed; no recipients")) | 387 | (current-buffer))) |
| 388 | (error "Sending failed; SMTP protocol error")) | ||
| 389 | (error "Sending failed; no recipients"))) | ||
| 388 | (delete-file file-msg) | 390 | (delete-file file-msg) |
| 389 | (delete-file (concat file-msg ".el")) | 391 | (delete-file (concat file-msg ".el")) |
| 390 | (kill-buffer tembuf) | 392 | (kill-line 1)) |
| 391 | (kill-line 1)) | 393 | (write-region (point-min) (point-max) smtpmail-queue-index)))) |
| 392 | (set-buffer buffer-index) | ||
| 393 | (save-buffer smtpmail-queue-index) | ||
| 394 | (kill-buffer buffer-index) | ||
| 395 | ))) | ||
| 396 | 394 | ||
| 397 | ;(defun smtpmail-via-smtp (host,port,sender,destination,smtpmail-text-buffer) | 395 | ;(defun smtpmail-via-smtp (host,port,sender,destination,smtpmail-text-buffer) |
| 398 | 396 | ||