Mercurial > emacs
comparison lisp/mail/smtpmail.el @ 42225:8ef1ae58dc29
(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>.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Fri, 21 Dec 2001 12:06:21 +0000 |
parents | de4a90cd0a5f |
children | c18dd95f6962 |
comparison
equal
deleted
inserted
replaced
42224:9709e1618364 | 42225:8ef1ae58dc29 |
---|---|
365 (kill-buffer errbuf))))) | 365 (kill-buffer errbuf))))) |
366 | 366 |
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))) |
378 (load file-msg) | 378 (load file-msg) |
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 |
399 (defun smtpmail-fqdn () | 397 (defun smtpmail-fqdn () |
400 (if smtpmail-local-domain | 398 (if smtpmail-local-domain |