Commit 835bdcba authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen
Browse files

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.
parent d29b2b4c
......@@ -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>
......
......@@ -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)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment