SMTPserver = 'smtp...'
sender =     'endereco_sender@dominio'
destination = ['destino...']

USERNAME = "usuario_smtp"
PASSWORD = "senha_smtp"

# typical values for text_subtype are plain, html, xml
text_subtype = 'plain'


content="""\
Test message
"""

subject="Sent from Python"

import sys
import os
import re

from smtplib import SMTP_SSL as SMTP       # this invokes the secure SMTP protocol (port 465, uses SSL)
# from smtplib import SMTP                  # use this for standard SMTP protocol   (port 25, no encryption)

# old version
# from email.MIMEText import MIMEText
from email.mime.text import MIMEText

try:
    msg = MIMEText(content, text_subtype)
    msg['Subject']=       subject
    msg['From']   = sender # some SMTP servers will do this automatically, not all

    conn = SMTP(SMTPserver)
    conn.set_debuglevel(False)
    conn.login(USERNAME, PASSWORD)
    try:
        conn.sendmail(sender, destination, msg.as_string())
    finally:
        conn.quit()

except Exception, exc:
    sys.exit( "mail failed; %s" % str(exc) ) # give a error message

Este artigo foi útil ?
SimNão

6 Replies to “Envio de e-mail com Python”

  1. 33win39bet disse:

    Had a flutter on 33win39bet. Managed to win a little something back, so can’t complain! Worth a try if you fancy your chances. Good luck to everyone!33win39bet

  2. 11qbet disse:

    Yo, I just signed up with 11qbet. The bonuses are pretty fire. Gotta check it out! Try it out: 11qbet

  3. juwa6 disse:

    Alright, checking out juwa6.info. Seems like they’ve got a decent setup. It’s not too shabby. Could use some improvement, but overall not bad. Check out juwa6 for yourself.

  4. ph365betapp disse:

    Downloaded the ph365betapp the other day. It’s pretty slick. Makes betting on my phone way easier. If you’re on the go a lot like I am, this app is a must-have. You can check it at ph365betapp

  5. 389win1 disse:

    Gave 389win1 a shot. Interface is clean, navigation is pretty good. Might be worth a look if you’re searching for something new. Take a look here instead: 389win1

  6. 1wincassino disse:

    1wincassino, I’ve heard of it, yeah. Nothing particularly stood out, but nothing bad either. Standard online casino stuff, plenty of games to choose from. See if it’s your thing: 1wincassino

Deixe um comentário para 11qbet Cancelar resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

Close Search Window