From: Lie Ryan on
On 11/27/2009 8:43 PM, Ramdas wrote:
> I tried with MIMEBASE but it still fails...... I changed it to
> MIMEText, hoping that might trick __handletext to think its a string
> Anyway that also doesn't work.
>

just pass the string directly to MIMEBase.set_payload:

fp = open('...')
msg1 = MIMEBase(maintype, subtype)
msg1.set_payload(fp.read())

either that or use a more specialized subclass of MIMEBase (e.g. MIMEText).