Mercurial > hg > mercurial-crew
diff mercurial/mail.py @ 5472:23889160905a 0.9.5
Catch smtp exceptions
author | Christian Ebert <blacktrash@gmx.net> |
---|---|
date | Fri, 07 Sep 2007 16:48:42 +0200 (2007-09-07) |
parents | a11e13d50645 |
children | 4fba4fee0718 |
line wrap: on
line diff
--- a/mercurial/mail.py +++ b/mercurial/mail.py @@ -67,7 +67,13 @@ return _sendmail(ui, method) def sendmail(ui, sender, recipients, msg): - return connect(ui).sendmail(sender, recipients, msg) + try: + return connect(ui).sendmail(sender, recipients, msg) + except smtplib.SMTPRecipientsRefused, inst: + recipients = [r[1] for r in inst.recipients.values()] + raise util.Abort('\n' + '\n'.join(recipients)) + except smtplib.SMTPException, inst: + raise util.Abort(inst) def validateconfig(ui): '''determine if we have enough config data to try sending email.'''