From 45ec64a58efb03ef48b8dd9fa7ec2b9b45e546ac Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 11 Jul 2012 12:06:38 +0530 Subject: [PATCH] fixes in outgoing email connection error handling --- .../doctype/email_settings/email_settings.py | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/erpnext/setup/doctype/email_settings/email_settings.py b/erpnext/setup/doctype/email_settings/email_settings.py index 755b91d20ac..118dba2e1c3 100644 --- a/erpnext/setup/doctype/email_settings/email_settings.py +++ b/erpnext/setup/doctype/email_settings/email_settings.py @@ -54,24 +54,13 @@ class DocType: webnotes.msgprint(err_msg) raise e + # exceptions are handled in smtp_connect + sess = out_email.smtp_connect() + try: - sess = out_email.smtp_connect() - - try: - sess.quit() - except: - pass - except _socket.error, e: - # Invalid mail server -- due to refusing connection - webnotes.msgprint('Invalid Outgoing Mail Server or Port. Please rectify and try again.') - raise e - except smtplib.SMTPAuthenticationError, e: - webnotes.msgprint('Invalid Login Id or Mail Password. Please rectify and try again.') - raise e - except smtplib.SMTPException, e: - webnotes.msgprint('There is something wrong with your Outgoing Mail Settings. \ - Please contact us at support@erpnext.com') - raise e + sess.quit() + except: + pass def validate_incoming(self):