1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-23 18:47:57 +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 * mail/smtpmail.el (smtpmail-query-smtp-server): Fix typo in the
way the ports list is computed. 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> 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 () (defun smtpmail-query-smtp-server ()
(let ((server (read-string "Outgoing SMTP mail server: ")) (let ((server (read-string "Outgoing SMTP mail server: "))
(ports '(25 587)) (ports '(25 587))
stream port) stream port prompted)
(when (and smtpmail-smtp-service (when (and smtpmail-smtp-service
(not (member smtpmail-smtp-service ports))) (not (member smtpmail-smtp-service ports)))
(push smtpmail-smtp-service ports)) (push smtpmail-smtp-service ports))
(while (and (not smtpmail-smtp-server) (while (and (not smtpmail-smtp-server)
(setq port (pop ports))) (setq port (pop ports)))
(when (setq stream (condition-case () (if (not (setq stream (condition-case ()
(open-network-stream "smtp" nil server port) (open-network-stream "smtp" nil server port)
(quit nil) (quit nil)
(error 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-server server)
(customize-save-variable 'smtpmail-smtp-service port) (customize-save-variable 'smtpmail-smtp-service port)
(delete-process stream))) (delete-process stream)))