Junior — Senior
Creating an email sending service using Dependency Injection
livecode
Task condition
It is necessary to implement a mechanism for sending emails, strictly following the dependency injection principle. Define an abstract base class SendMessage and its concrete implementation SendMail.
from abc import ABC, abstractmethod
class SendMessage(ABC):
@abstractmethod
def send(self, res: str, text: str, subject: str) -> None:
pass
class SendMail(SendMessage):
def send(self, res: str, text: str, subject: str) -> None:
print("Email:", res, text, subject)