2021.4 #19
@ -8,10 +8,24 @@ class EMailClientABC(ServiceABC):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
"""
|
||||||
|
ABC to send emails
|
||||||
|
"""
|
||||||
ServiceABC.__init__(self)
|
ServiceABC.__init__(self)
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def connect(self): pass
|
def connect(self):
|
||||||
|
"""
|
||||||
|
Connects to server
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def send_mail(self, email: EMail): pass
|
def send_mail(self, email: EMail):
|
||||||
|
"""
|
||||||
|
Sends email
|
||||||
|
:param email:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
@ -39,10 +39,6 @@ class EMailClient(EMailClientABC):
|
|||||||
self._logger.trace(__name__, f'Stopped {__name__}.create')
|
self._logger.trace(__name__, f'Stopped {__name__}.create')
|
||||||
|
|
||||||
def connect(self):
|
def connect(self):
|
||||||
"""
|
|
||||||
Connects to server
|
|
||||||
:return:
|
|
||||||
"""
|
|
||||||
self._logger.trace(__name__, f'Started {__name__}.connect')
|
self._logger.trace(__name__, f'Started {__name__}.connect')
|
||||||
try:
|
try:
|
||||||
self._logger.debug(__name__, f'Try to connect to {self._mail_settings.host}:{self._mail_settings.port}')
|
self._logger.debug(__name__, f'Try to connect to {self._mail_settings.host}:{self._mail_settings.port}')
|
||||||
@ -73,11 +69,6 @@ class EMailClient(EMailClientABC):
|
|||||||
self._logger.trace(__name__, f'Stopped {__name__}.login')
|
self._logger.trace(__name__, f'Stopped {__name__}.login')
|
||||||
|
|
||||||
def send_mail(self, email: EMail):
|
def send_mail(self, email: EMail):
|
||||||
"""
|
|
||||||
Sends email
|
|
||||||
:param email:
|
|
||||||
:return:
|
|
||||||
"""
|
|
||||||
self._logger.trace(__name__, f'Started {__name__}.send_mail')
|
self._logger.trace(__name__, f'Started {__name__}.send_mail')
|
||||||
try:
|
try:
|
||||||
self.login()
|
self.login()
|
||||||
|
Loading…
Reference in New Issue
Block a user