This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author elachuni
Recipients elachuni, hsp
Date 2008-06-21.21:05:30
SpamBayes Score 0.003719388
Marked as misclassified No
Message-id <1214082332.43.0.318824735803.issue1556@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2008-06-21 21:05:32elachunisetspambayes_score: 0.00371939 -> 0.003719388
recipients: + elachuni, hsp
2008-06-21 21:05:32elachunisetspambayes_score: 0.00371939 -> 0.00371939
messageid: <1214082332.43.0.318824735803.issue1556@psf.upfronthosting.co.za>
2008-06-21 21:05:31elachunilinkissue1556 messages
2008-06-21 21:05:30elachunicreate