rendered paste body#!/usr/bin/env python"""Sends an email."""__revision__ = '0.0.5'import sys# Import smtplib for the actual sending functionimport smtplib# Import the email modules we'll needfrom email.MIMEBase import MIMEBasefrom email.MIMEMultipart import MIMEMultipartfrom email import Encoders#sender = 'cciupitu@nuxeo.com'#recipient = 'avoinea@nuxeo.com'#recipient = sender = 'christi@mir.lizeanunet.ro'sender = 'proXoare@kix.ro'recipient = 'avoX@Xxeo.com'filename = sys.argv[1]outer = MIMEMultipart()outer['Subject'] = 'The contents of %s' % filenameouter['From'] = senderouter['To'] = recipientouter.preamble = 'Attached is the contents of:\n%s' % filenameouter.epilogue = ''# Create a messagemaintype, subtype = 'application', 'octet-stream'msg = MIMEBase(maintype, subtype)msg.set_payload(open(filename, 'rb').read())# Encode the payload using Base64Encoders.encode_base64(msg)msg.add_header('Content-Disposition', 'attachment', filename=filename)# Attach the fileouter.attach(msg)# Send the message via our own SMTP server, but don't include the# envelope header.#s = smtplib.SMTP('localhost')s = smtplib.SMTP()print 's.connect()'s.connect()print 's.sendmail(...)'s.sendmail(sender, [recipient], outer.as_string())print 's.close(...)'s.close()