From ba0abf5a76299fa7b8b6f16b3ac6187344a96276 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Wed, 30 Mar 2005 00:21:47 +0000 Subject: [PATCH] Se atrapan errores STMP de una forma no muy elegante. --- src/sc_deliver | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/sc_deliver b/src/sc_deliver index 45975cd..cd4bc00 100755 --- a/src/sc_deliver +++ b/src/sc_deliver @@ -30,9 +30,17 @@ a su intento %d, recibido el %s. mail['Return-Path'] = conf.get('mail', 'admin') mail['X-Mailer'] = 'sercom ' + sercom.VERSION mail['X-Priority'] = '5' - smtp = smtplib.SMTP(conf.get('mail', 'smtp')) - smtp.sendmail(mail['From'], mail['To'], mail.as_string()) - smtp.close() + sent = False + while not sent: + try: + smtp = smtplib.SMTP(conf.get('mail', 'smtp')) + smtp.sendmail(mail['From'], mail['To'], mail.as_string()) + smtp.close() + sent = True + except smtplib.SMTPException, e: + log.warning('No se pudo enviar el mail a %s (%s)', + inscripto.padron, inscripto.mail) + time.sleep(1) # Inicializo conf, conn, log = sercom.init('deliver') -- 2.43.0