From eeb550da5023ce685fb3d6bfbdff1040b7c3c048 Mon Sep 17 00:00:00 2001 From: okada Date: Mon, 19 Nov 2001 04:37:23 +0000 Subject: [PATCH] smtp.el (smtp-find-server): Fix. --- ChangeLog | 4 ++++ smtp.el | 79 ++++++++++++++++++++++++++++++++----------------------------- 2 files changed, 45 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 744d28a..27e6b42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2001-11-19 Kenichi OKADA + + * smtp.el (smtp-find-server): Fix. + 2001-11-18 Kenichi OKADA * smtp.el (smtp-send-by-myself): Fix. diff --git a/smtp.el b/smtp.el index 9c4fcba..4531880 100644 --- a/smtp.el +++ b/smtp.el @@ -283,22 +283,25 @@ of the host to connect to. SERVICE is name of the service desired." (kill-buffer dig-buf)))) (defun smtp-find-server (recipients) - (let ((rec - (mapcar (lambda (recipient) - (if (string-match "@\\([^\t\n ]*\\)" recipient) - (cons - (smtp-find-mx - (match-string 1 recipient)) - (list recipient)))) - recipients)) - ret rets rlist) - (while (setq rets (pop rec)) - (if (setq ret (assoc (car rets) rec)) - (setcdr ret - (append (cdr ret) (cdr rets))) - (setq rlist - (append rlist (list rets))))) - rlist)) + (save-excursion + (let ((rec + (mapcar (lambda (recipient) + (let (server) + (if (and (string-match "@\\([^\t\n ]*\\)" recipient) + (setq server + (smtp-find-mx + (match-string 1 recipient)))) + (cons server (list recipient)) + (error (format "cannot find server for %s." recipient))))) + recipients)) + ret rets rlist) + (while (setq rets (pop rec)) + (if (setq ret (assoc (car rets) rec)) + (setcdr ret + (append (cdr ret) (cdr rets))) + (setq rlist + (append rlist (list rets))))) + rlist))) ;;;###autoload (defun smtp-via-smtp (sender recipients buffer) @@ -380,28 +383,28 @@ BUFFER may be a buffer or a buffer name which contains mail message." #'starttls-open-stream smtp-open-connection-function)) server package) - (while (car servers) - (setq server (caar servers)) - (setq recipients (cdar servers)) - (if (not (and server recipients)) - ;; MAILER-DAEMON is required. :) - (error (format "Cannot send <%s>" - (mapconcat 'concat recipients ">,<")))) - (setq package - (smtp-make-package sender recipients buffer)) - (save-excursion - (set-buffer - (get-buffer-create - (format "*trace of SMTP session to %s*" server))) - (erase-buffer) - (buffer-disable-undo) - (unless (smtp-find-connection (current-buffer)) - (smtp-open-connection (current-buffer) server smtp-service)) - (make-local-variable 'smtp-read-point) - (setq smtp-read-point (point-min)) - (let ((smtp-use-sasl nil) - (smtp-use-starttls-ignore-error t)) - (funcall smtp-submit-package-function package))) + (while (car servers) + (setq server (caar servers)) + (setq recipients (cdar servers)) + (if (not (and server recipients)) + ;; MAILER-DAEMON is required. :) + (error (format "Cannot send <%s>" + (mapconcat 'concat recipients ">,<")))) + (setq package + (smtp-make-package sender recipients buffer)) + (save-excursion + (set-buffer + (get-buffer-create + (format "*trace of SMTP session to %s*" server))) + (erase-buffer) + (buffer-disable-undo) + (unless (smtp-find-connection (current-buffer)) + (smtp-open-connection (current-buffer) server smtp-service)) + (make-local-variable 'smtp-read-point) + (setq smtp-read-point (point-min)) + (let ((smtp-use-sasl nil) + (smtp-use-starttls-ignore-error t)) + (funcall smtp-submit-package-function package))) (setq servers (cdr servers))))) ;;; @ hook methods for `smtp-submit-package' -- 1.7.10.4