using the email module

Erik Johnson ejatwellkeeperdotcom
Thu Sep 28 14:31:19 EDT 2006


"Sybren Stuvel" wrote:

> If the HTML document should really be attached, give it a
>     Content-Disposition: Attachment
> header. Check out the accompanying headers as well, by simply emailing
> yourself an attached HTML file and examining the email source.

html = """\
<html>
...
</html>
"""
attachment = MIMEText(html, 'html')
attachment['Content-Disposition'] = 'attachment; filename="sample.html"'
msg.attach(attachment)


# Ah! Yes, that works! Thank you! ;)





More information about the Python-list mailing list