Author Allison.Vollmann
Recipients Allison.Vollmann
Date 2010-03-03.15:00:13
SpamBayes Score 3.65789e-08
Marked as misclassified No
Message-id <1267628417.9.0.660961800232.issue8050@psf.upfronthosting.co.za>
In-reply-to
Content
When call SMTP.sendmail (with simple sendmail local sent and with smtp auth), the follow exception be raised (with debug output):

send: 'mail FROM:<xxx> size=5\r\n'
reply: '250 2.1.0 Ok\r\n'
reply: retcode (250); Msg: 2.1.0 Ok
send: 'rcpt TO:<xxx>\r\n'
reply: '250 2.1.5 Ok\r\n'
reply: retcode (250); Msg: 2.1.5 Ok
send: 'data\r\n'
reply: '354 End data with <CR><LF>.<CR><LF>\r\n'
reply: retcode (354); Msg: End data with <CR><LF>.<CR><LF>
data: (354, 'End data with <CR><LF>.<CR><LF>')

Traceback (most recent call last):
  File "<pyshell#14>", line 1, in <module>
    s.sendmail(to, to, msg)
  File "C:\Python26\lib\smtplib.py", line 710, in sendmail
    (code,resp) = self.data(msg)
  File "C:\Python26\lib\smtplib.py", line 474, in data
    q = quotedata(msg)
  File "C:\Python26\lib\smtplib.py", line 157, in quotedata
    re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data))
  File "C:\Python26\lib\re.py", line 151, in sub
    return _compile(pattern, 0).sub(repl, string, count)
TypeError: expected string or buffer

This error appear because 'data' isn't an string object, just replacing "q = quotedata(msg)" for "q = quotedata(str(msg))" (in Python26\lib\smtplib.py:474) solves the problem, but i can't understand how this simple mistake does not be noticed

Teste in: 
Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
[GCC 4.3.2] on linux2,
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32
History
Date User Action Args
2010-03-03 15:00:18Allison.Vollmannsetrecipients: + Allison.Vollmann
2010-03-03 15:00:17Allison.Vollmannsetmessageid: <1267628417.9.0.660961800232.issue8050@psf.upfronthosting.co.za>
2010-03-03 15:00:15Allison.Vollmannlinkissue8050 messages
2010-03-03 15:00:14Allison.Vollmanncreate