1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-08 15:35:02 +00:00

smtpmail initial prompting fixes

(smtpmail-query-smtp-server): Prompt the user for a port number if
we can't connect to any of the standard ports.
This commit is contained in:
Lars Ingebrigtsen 2012-02-14 16:43:07 +01:00
parent d29b2b4cb7
commit 835bdcba53
2 changed files with 15 additions and 5 deletions

View File

@ -2,6 +2,8 @@
* mail/smtpmail.el (smtpmail-query-smtp-server): Fix typo in the
way the ports list is computed.
(smtpmail-query-smtp-server): Prompt the user for a port number if
we can't connect to any of the standard ports (bug#10810).
2012-02-14 Teodor Zlatanov <tzz@lifelogs.com>

View File

@ -598,16 +598,24 @@ The list is in preference order.")
(defun smtpmail-query-smtp-server ()
(let ((server (read-string "Outgoing SMTP mail server: "))
(ports '(25 587))
stream port)
stream port prompted)
(when (and smtpmail-smtp-service
(not (member smtpmail-smtp-service ports)))
(push smtpmail-smtp-service ports))
(while (and (not smtpmail-smtp-server)
(setq port (pop ports)))
(when (setq stream (condition-case ()
(open-network-stream "smtp" nil server port)
(quit nil)
(error nil)))
(if (not (setq stream (condition-case ()
(open-network-stream "smtp" nil server port)
(quit nil)
(error nil))))
;; We've used up the list of default ports, so query the
;; user.
(when (and (not ports)
(not prompted))
(push (read-number (format "Port number to use when contacting %s? "
server))
ports)
(setq prompted t))
(customize-save-variable 'smtpmail-smtp-server server)
(customize-save-variable 'smtpmail-smtp-service port)
(delete-process stream)))