From Crippled Hornbill, 1 Week ago, written in Python.
This paste is a reply to Re: envía correos desde python from Sole Kangaroo
- view diff
Embed
Download Paste or View Raw

  1. # envia_correo.py
  2. # ---------------------------------------------------------
  3.  
  4. from email.mime.text import MIMEText
  5. from smtplib import SMTP
  6.  
  7. def manda_correo(nombre, direccion):
  8.  
  9.     from_address = "brunoruizv@gmail.com"
  10.     to_address = direccion
  11.     message = "Hola " + nombre +", \n\n" + \
  12.         "Este correo es solo para saludarte." + \
  13.         "\n\nAtentamente," + \
  14.         "\n\nTu funcion que manda correos desde Python."
  15.  
  16.     mime_message = MIMEText(message, "plain")
  17.     mime_message["From"] = from_address
  18.     mime_message["To"] = to_address
  19.     mime_message["Subject"] = "Saludos " + nombre
  20.  
  21.     smtp = SMTP("smtp.gmail.com")
  22.     smtp.login(from_address, "texicano04")
  23.     smtp.sendmail(from_address, to_address, mime_message.as_string())
  24.     smtp.quit()
  25.  
  26. manda_correo("Bruno","brunoruizv@gmail.com")
  27.  
  28.  

Replies to Re: Re: envía correos desde python rss

Title Name Language When
Re: Re: Re: envía correos desde python Soft Camel python 1 Week ago.
Re: Re: Re: envía correos desde python Coral Tapir python 1 Week ago.