Also allow retry if recipient got rejected

This commit is contained in:
Andreas Moog 2011-12-03 11:57:18 +01:00
parent 12030d99e9
commit d18a35c449

View File

@ -200,10 +200,18 @@ Content-Type: text/plain; charset=UTF-8
s.quit()
return
while True:
try:
s.sendmail(myemailaddr, to, mail.encode('utf-8'))
s.quit()
os.remove(f.name)
Logger.normal('Sync request mailed.')
except:
Logger.error('Unknown error while sending the mail.')
break
except smtplib.SMTPRecipientsRefused, smtperror:
smtp_code, smtp_message = smtperror.recipients[to]
Logger.error('Error while sending: %i, %s', smtp_code, smtp_message)
if smtp_code == 450:
confirmation_prompt(message='This is a temporary error, press '
'[Enter] to retry. Press [Ctrl-C] to abort now.')
else:
return