How to add an attachment with smtplib module

Steve Holden sholden at holdenweb.com
Thu Apr 29 05:20:37 EDT 2004


Sean Berry wrote:

> I have the sample script that uses the smtplib module
> that is available at python.org.
> 
> How can I use this to send an attachment?
> 
> Help is greatly appreciated.
> 
> Thanks.
> 
Take a look at the "email" module, which is the usual way of generating 
messages of complex structure. Then, specifically, look at "Creating 
email and MIME objects from scratch" at (e.g.) 
http://docs.python.org/lib/node501.html - you'll probably have the same 
page in your local Python docs.

regards
  Steve



More information about the Python-list mailing list