adding local_hostname option to smtp configuration
authorValentino Volonghi aka dialtone <dialtone@divmod.com>
Sun, 09 Jul 2006 14:12:19 +0200
changeset 2583 6e5427447f4c
parent 2576 6a961a54f953
child 2584 1f4703115e28
adding local_hostname option to smtp configuration
doc/hgrc.5.txt
mercurial/ui.py
--- a/doc/hgrc.5.txt
+++ b/doc/hgrc.5.txt
@@ -309,6 +309,9 @@ smtp::
     Optional.  Password to authenticate to SMTP server with.
     If username is specified, password must also be specified.
     Default: none.
+  local_hostname;;
+    Optional.  It's the hostname that the sender can use to identify itself
+    to the MTA.
 
 paths::
   Assigns symbolic names to repositories.  The left side is the
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -298,7 +298,8 @@ class ui(object):
         def smtp():
             '''send mail using smtp.'''
 
-            s = smtplib.SMTP()
+            local_hostname = self.config('smtp', 'local_hostname')
+            s = smtplib.SMTP(local_hostname=local_hostname)
             mailhost = self.config('smtp', 'host')
             if not mailhost:
                 raise util.Abort(_('no [smtp]host in hgrc - cannot send mail'))