Anthony Lenton <[EMAIL PROTECTED]> added the comment:

I don't really think the MIMEBase class is supposed to be used like
this, or at all: it behaves more like a Multipart message in that it
expects to carry a list of MIMEBase objects as a payload (not a string!)
though it doesn't define a boundary by default.

You can carry on using the MIMEBase class, but changing the line that says:

    attachment.set_payload(file(filename).read( ))

for:

    attachment.set_payload([MIMEText(file(filename).read())])

I'd recommend you to use:

    attachment = Message()
    attachment.set_payload(file(filename).read())

or if you want a multipart message:

    attachment = MIMEMultipart()
    text = MIMEText(file(filename).read())
    attachment.attach(text)

----------
nosy: +elachuni

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1556>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to