string payload expected: <type 'list'> error

Lie Ryan lie.1296 at gmail.com
Sun Nov 29 16:55:57 CET 2009


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).



More information about the Python-list mailing list