summaryrefslogtreecommitdiffstats
path: root/Lib/smtplib.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-06-09 15:13:10 (GMT)
committerGuido van Rossum <guido@python.org>1999-06-09 15:13:10 (GMT)
commitdb23d3dbf73e3a1a0f9caa0e0a026aa933a61e9d (patch)
treee4a3a57e3d70f516a7a12b195034322583cf5236 /Lib/smtplib.py
parent4727456d46d54ba0b61878251db823bf15182e60 (diff)
downloadcpython-db23d3dbf73e3a1a0f9caa0e0a026aa933a61e9d.zip
cpython-db23d3dbf73e3a1a0f9caa0e0a026aa933a61e9d.tar.gz
cpython-db23d3dbf73e3a1a0f9caa0e0a026aa933a61e9d.tar.bz2
Patch by Per Cederqvist:
I've found two places where smtplib.py sends an extra trailing space on command lines to the SMTP server. I don't know if this ever causes any problems, but I'd prefer to be on the safe side. The enclosed patch removes the extra space.
Diffstat (limited to 'Lib/smtplib.py')
-rwxr-xr-xLib/smtplib.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index 370182e..8cca590 100755
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -231,7 +231,10 @@ class SMTP:
def putcmd(self, cmd, args=""):
"""Send a command to the server."""
- str = '%s %s%s' % (cmd, args, CRLF)
+ if args == "":
+ str = '%s%s' % (cmd, CRLF)
+ else:
+ str = '%s %s%s' % (cmd, args, CRLF)
self.send(str)
def getreply(self):
@@ -345,8 +348,8 @@ class SMTP:
"""SMTP 'mail' command -- begins mail xfer session."""
optionlist = ''
if options and self.does_esmtp:
- optionlist = string.join(options, ' ')
- self.putcmd("mail", "FROM:%s %s" % (quoteaddr(sender) ,optionlist))
+ optionlist = ' ' + string.join(options, ' ')
+ self.putcmd("mail", "FROM:%s%s" % (quoteaddr(sender) ,optionlist))
return self.getreply()
def rcpt(self,recip,options=[]):