Added SmtpServerChannelException custom exception

This commit is contained in:
kuldeep.k@cisinlabs.com 2021-08-31 22:23:37 +05:30
parent 2303a4d4e5
commit 2ac7b572e8
No known key found for this signature in database
GPG Key ID: AF4FB299BF7C7C2A

View File

@ -28,6 +28,11 @@ logger = logging.getLogger('default')
# pylint: disable=attribute-defined-outside-init
class SmtpServerChannelException(Exception):
"""Generic smtp server channel exception."""
pass
class smtpServerChannel(smtpd.SMTPChannel):
"""Asyncore channel for SMTP protocol (server)"""
def smtp_EHLO(self, arg):
@ -54,7 +59,7 @@ class smtpServerChannel(smtpd.SMTPChannel):
self.auth = True
self.push('235 2.7.0 Authentication successful')
else:
raise Exception("Auth fail")
raise SmtpServerChannelException("Auth fail")
except: # noqa:E722
self.push('501 Authentication fail')