<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Here, my code of sendmail
If Somebody had a doubt please contact me?
[EMAIL PROTECTED]
[snip]
If you have multiple recipients, you need to modify
server.sendmail(msg['From'],toaddrs,msg.as_string())
to
failed = server.sendmail(msg['From'],toaddrs,msg.as_string())
# exception is only raised if ALL recips fail
# failed is a list of failed recips, or empty
You could also expand your smtplib exception handling
[not tested]
try:
server = smtplib.SMTP(servidor_smtp)
## Faz o envio do email.
try:
failed = server.sendmail(msg['From'],toaddrs,msg.as_string())
if failed:
do something
## Fecha a conex�o com o servidor
except smtplib.SMTPRecipientsRefused, x : #all recips failed before
data sent = MSG failed
do something
except smtplip.SMTPDataError, x: # an error at the end of the
message body receipt = MSG Failed
do something
except smtplib.SMTPSenderRefused, x : # the sender was refused = MSG
failed
do something
except: #can't connect
do something
finally
server.quit()
except Exception, e:
arq=open(dir_log,'a')
print >> arq, "Falha no envio da mensagem de email, n�o foi
--
=================================
Tim Williams
--
http://mail.python.org/mailman/listinfo/python-list