classification
Title: hooks/mail.py requires [smtp] host to be set, despite a comment to the contrary
Type: Stage:
Components: Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: eric.smith Nosy List: eric.smith, ezio.melotti, pitrou
Priority: normal Keywords: easy

Created on 2013-04-01 22:00 by eric.smith, last changed 2013-04-02 12:39 by pitrou.

Messages (2)
msg185777 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2013-04-01 22:00
In the mail hook, there's a comment that says:

'''
To set the SMTP server to something other than localhost, add a [smtp]
section to your hgrc:

[smtp]
host = mail.python.org
port = 25
'''

This is not true. The default host is '', which tells smtplib.SMTP to not make an initial connection. If we want the comment to be correct, then we need to set 'localhost' as the default:

-    host = ui.config('smtp', 'host', '')
+    host = ui.config('smtp', 'host', 'localhost')

I guess there's some chance that we want to force the smtp host to be set. If that's the case then then comment should be changed and the code modified to require the host be specified in the config file (or at least a better error message than 'please run connect() first').

Adding Antoine because annotate points to him for these lines.
msg185833 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-04-02 12:39
Well, mercurial itself requires the presence of a "host" item in "[smtp]", so it would make sense to require it too.
History
Date User Action Args
2013-04-02 12:39:18pitrousetnosy: + ezio.melotti
messages: + msg185833
2013-04-01 22:00:55eric.smithcreate