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