[Tutor] pdf file as attachment

Kent Johnson kent_johnson at skillsoft.com
Mon Aug 23 22:27:46 CEST 2004

I think you need to send the pdf with the mime type 'application/pdf' 
instead of text. Here is an example that may help you: 

Alternatively you might write your own MIMEPdf class by modifying MIMEText 
- if you look at Python/Lib/email/MIMEText.py there is not much there to 

At 04:18 PM 8/22/2004 -0400, r2b2 wrote:

>looking for a little help sending a PDF file as file attachment to an 
>email message. The below code works with a text tpye doc but wandering how 
>i can send a PDF file.
>from email.MIMEMultipart import MIMEMultipart
>from email.MIMEText import MIMEText
>from email.MIMEImage import MIMEImage
>#from email.MIMEMultipart import MIMEMultipart
>msg=MIMEMultipart("this is a test")
>import smtplib
>s.sendmail('mail at aol.com',msg.as_string())
>No banners. No pop-ups. No kidding.
>Make My Way your home on the Web - http://www.myway.com
>Tutor maillist  -  Tutor at python.org

More information about the Tutor mailing list