Mercurial > hg > mercurial-crew
comparison 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 |
parents | a11e13d50645 |
children | 4fba4fee0718 |
comparison
equal
deleted
inserted
replaced
5471:5b81c1cc6ebe | 5472:23889160905a |
---|---|
65 return _smtp(ui) | 65 return _smtp(ui) |
66 | 66 |
67 return _sendmail(ui, method) | 67 return _sendmail(ui, method) |
68 | 68 |
69 def sendmail(ui, sender, recipients, msg): | 69 def sendmail(ui, sender, recipients, msg): |
70 return connect(ui).sendmail(sender, recipients, msg) | 70 try: |
71 return connect(ui).sendmail(sender, recipients, msg) | |
72 except smtplib.SMTPRecipientsRefused, inst: | |
73 recipients = [r[1] for r in inst.recipients.values()] | |
74 raise util.Abort('\n' + '\n'.join(recipients)) | |
75 except smtplib.SMTPException, inst: | |
76 raise util.Abort(inst) | |
71 | 77 |
72 def validateconfig(ui): | 78 def validateconfig(ui): |
73 '''determine if we have enough config data to try sending email.''' | 79 '''determine if we have enough config data to try sending email.''' |
74 method = ui.config('email', 'method', 'smtp') | 80 method = ui.config('email', 'method', 'smtp') |
75 if method == 'smtp': | 81 if method == 'smtp': |