changeset 3878:6d14a3b4e295

allow admin to specify port and local hostname for SMTP connections
author Justus Pendleton <jpend@users.sourceforge.net>
date Sun, 02 Sep 2007 05:54:46 +0000
parents 83748b2de465
children 454ee9411e85
files doc/customizing.txt roundup/configuration.py roundup/mailer.py
diffstat 3 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/doc/customizing.txt	Sat Sep 01 16:30:11 2007 +0000
+++ b/doc/customizing.txt	Sun Sep 02 05:54:46 2007 +0000
@@ -2,7 +2,7 @@
 Customising Roundup
 ===================
 
-:Version: $Revision: 1.218 $
+:Version: $Revision: 1.219 $
 
 .. This document borrows from the ZopeBook section on ZPT. The original is at:
    http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -240,6 +240,15 @@
   SMTP login password.
   Set this if your mail host requires authenticated access.
 
+ port -- default *25*
+  SMTP port on mail host.
+  Set this if your mail host runs on a different port.
+
+ local_hostname -- default *blank*
+  The fully qualified domain name (FQDN) to use during SMTP sessions. If left
+  blank, the underlying SMTP library will attempt to detect your FQDN. If your
+  mail host requires something specific, specify the FQDN to use.
+
  tls -- ``no``
   If your SMTP mail host provides or requires TLS (Transport Layer Security)
   then you may set this option to 'yes'.
--- a/roundup/configuration.py	Sat Sep 01 16:30:11 2007 +0000
+++ b/roundup/configuration.py	Sun Sep 02 05:54:46 2007 +0000
@@ -1,6 +1,6 @@
 # Roundup Issue Tracker configuration support
 #
-# $Id: configuration.py,v 1.44 2007-09-01 16:30:11 forsberg Exp $
+# $Id: configuration.py,v 1.45 2007-09-02 05:54:46 jpend Exp $
 #
 __docformat__ = "restructuredtext"
 
@@ -12,6 +12,7 @@
 import re
 import sys
 import time
+import smtplib
 
 import roundup.date
 
@@ -614,6 +615,12 @@
             "If username is not empty, password (below) MUST be set!"),
         (Option, "password", NODEFAULT, "SMTP login password.\n"
             "Set this if your mail host requires authenticated access."),
+        (IntegerNumberOption, "port", smtplib.SMTP_PORT,
+            "Default port to send SMTP on.\n"
+            "Set this if your mail server runs on a different port."),
+        (NullableOption, "local_hostname", '',
+            "The local hostname to use during SMTP transmission.\n"
+            "Set this if your mail server requires something specific."),
         (BooleanOption, "tls", "no",
             "If your SMTP mail host provides or requires TLS\n"
             "(Transport Layer Security) then set this option to 'yes'."),
--- a/roundup/mailer.py	Sat Sep 01 16:30:11 2007 +0000
+++ b/roundup/mailer.py	Sun Sep 02 05:54:46 2007 +0000
@@ -1,7 +1,7 @@
 """Sending Roundup-specific mail over SMTP.
 """
 __docformat__ = 'restructuredtext'
-# $Id: mailer.py,v 1.18 2006-08-11 01:41:25 richard Exp $
+# $Id: mailer.py,v 1.19 2007-09-02 05:54:46 jpend Exp $
 
 import time, quopri, os, socket, smtplib, re, sys, traceback
 
@@ -190,8 +190,8 @@
     ''' Open an SMTP connection to the mailhost specified in the config
     '''
     def __init__(self, config):
-
-        smtplib.SMTP.__init__(self, config.MAILHOST)
+        smtplib.SMTP.__init__(self, config.MAILHOST, port=config['MAIL_PORT'],
+                              local_hostname=config['MAIL_LOCAL_HOSTNAME'])
 
         # start the TLS if requested
         if config["MAIL_TLS"]:

Roundup Issue Tracker: http://roundup-tracker.org/