Check out this class that I've been using for some time. It makes attachments VERY easy.
http://motion.sourceforge.net/related/send_jpg.py Larry Bates 1. Attachments ([EMAIL PROTECTED]) 2. RE: Attachments (Brodie, R (Richard)) 3. Re: Attachments (Reggie Dugard) ---------------------------------------------------------------------- Message: 1 Date: Thu, 9 Dec 2004 13:22:58 +0000 From: [EMAIL PROTECTED] Subject: Attachments To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="us-ascii" I am using the below piece of code to send attachments. But the attachments are being inlined. They do not arrive as attachments. I would like to send multiple attachments. Anyhelp is appreciated. import sys, smtplib, MimeWriter, base64, StringIO def SendMailExt(self): REQUEST = self.REQUEST FILE = REQUEST.form['fileget'] message = StringIO.StringIO() writer = MimeWriter.MimeWriter(message) writer.addheader('Subject', 'TEST REQUEST FROM ATT') writer.startmultipartbody('mixed') # start off with a text/plain part part = writer.nextpart() body = part.startbody('text/plain') body.write('This is a test mail from Auto Test Tool :)') # now add an image part part = writer.nextpart() part.addheader('Content-Transfer-Encoding', 'base64') body = part.startbody('text/plain') base64.encode(open(FILE.filename, 'rb'), body) # finish off writer.lastpart() # send the mail smtp = smtplib.SMTP('mercury.sophos') smtp.sendmail('Auto Test [EMAIL PROTECTED]', '[EMAIL PROTECTED]', message.getvalue()) smtp.quit() return 'Request Sent\n' _______________________________________________ ActivePython mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython