git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] Support configurable SMTP port for stg mail.
@ 2005-07-21 20:18 Bryan larsen
  0 siblings, 0 replies; 3+ messages in thread
From: Bryan larsen @ 2005-07-21 20:18 UTC (permalink / raw)
  To: git; +Cc: catalin.marinas, Bryan Larsen

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

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:

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] Support configurable SMTP port for stg mail.
@ 2005-07-21 20:20 Bryan larsen
  2005-07-21 20:55 ` Catalin Marinas
  0 siblings, 1 reply; 3+ messages in thread
From: Bryan larsen @ 2005-07-21 20:20 UTC (permalink / raw)
  To: git; +Cc: catalin.marinas, Bryan Larsen

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 |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py
--- a/stgit/commands/mail.py
+++ b/stgit/commands/mail.py
@@ -68,8 +68,14 @@ 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)
+        s = smtplib.SMTP(smtpserver, smtpport)
     except Exception, err:
         raise CmdException, str(err)
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] Support configurable SMTP port for stg mail.
  2005-07-21 20:20 [PATCH 1/1] Support configurable SMTP port for stg mail Bryan larsen
@ 2005-07-21 20:55 ` Catalin Marinas
  0 siblings, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2005-07-21 20:55 UTC (permalink / raw)
  To: Bryan larsen; +Cc: git, Bryan Larsen

On Thu, 2005-07-21 at 16:20 -0400, Bryan larsen wrote:
> The example configuration file makes it appear that the SMTP port is configurable.  Make it so.

The documentation for smtplib.SMTP says that the smtpserver parameter is
passed to connect(). This latter function parses the smtpserver for
'server:port' like strings and does the right thing. I tried it with
Python 2.3 and it seems to work fine without this patch.

Thanks anyway.

-- 
Catalin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-07-21 20:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-21 20:20 [PATCH 1/1] Support configurable SMTP port for stg mail Bryan larsen
2005-07-21 20:55 ` Catalin Marinas
  -- strict thread matches above, loose matches on Subject: below --
2005-07-21 20:18 Bryan larsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).