threads / patch / 1287

patchSupport configurable SMTP port for stg mail.

Subject: [PATCH 1/1] Support configurable SMTP port for stg mail.

## tl;dr

One message between Jul 21, 2005 and Jul 21, 2005. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Bryan larsen· Jul 21, 2005, 20:18 UTC · lore
The example configuration file makes it appear that the SMTP port is configurable.  Make it so.
Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---
 stgit/commands/mail.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
Show changes to stgit/commands/mail.py +6 −0
diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py
--- a/stgit/commands/mail.py
+++ b/stgit/commands/mail.py
@@ -68,6 +68,12 @@ def __parse_addresses(string):
 def __send_message(smtpserver, from_addr, to_addr_list, msg, sleep):
     """Send the message using the given SMTP server
     """
+    if smtpserver.find(':')==-1:
+        smtpport=25
+    else:
+        smtpport=int(smtpserver[smtpserver.find(':')+1:])
+        smtpserver=smtpserver[:smtpserver.find(':')]
+
     try:
         s = smtplib.SMTP(smtpserver)
     except Exception, err:

← back to recent threads