diff --git a/Lib/smtplib.py b/Lib/smtplib.py index 370182e9f74..8cca5908e0e 100755 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -231,7 +231,10 @@ def send(self, str): 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 @@ def mail(self,sender,options=[]): """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=[]):