Para mandar correo con python y smtplib se muestra un ejemplo de código
Se utilizan los módulos smptlib y email que se incluyen por defecto en el core de python.
#!/usr/bin/python
from smtplib import SMTP
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
msg = MIMEMultipart()
msg['From'] = 'remitente@dominio.com'
msg['To'] = 'destinatario@dominio.com'
msg['Subject'] = 'Message subject'
msg.attach (MIMEText ('Message body', 'plain'))
smtp = SMTP()
smtp.connect ('Host or IP')
smtp.sendmail (msg['From'], msg['To'], msg.as_string())
smtp.quit()
#!/usr/bin/python
from smtplib import SMTP
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
msg = MIMEMultipart()
msg['From'] = 'remitente@dominio.com'
msg['To'] = 'destinatario@dominio.com'
msg['Subject'] = 'Message subject'
msg.attach (MIMEText ('Message body', 'plain'))
smtp = SMTP()
smtp.connect ('Host or IP')
try:
smtp.login ('User', 'Password')
except Exception, error:
print error
smtp.sendmail (msg['From'], msg['To'], msg.as_string())
smtp.quit()