* 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>
(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)))