Created
March 7, 2012 20:36
-
-
Save guerrerocarlos/1995955 to your computer and use it in GitHub Desktop.
send_email.py function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import smtplib | |
from email.mime.text import MIMEText | |
def enviar_correo(asunto,texto,destinatario,origen="[email protected]"): | |
msg = MIMEText(texto) | |
# me == the sender's email address | |
# you == the recipient's email address | |
msg['Subject'] = asunto | |
msg['From'] = origen | |
msg['To'] = destinatario | |
# Send the message via our own SMTP server, but don't include the | |
# envelope header. | |
s = smtplib.SMTP('localhost') | |
s.sendmail(origen, destinatario, msg.as_string()) | |
s.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment