Open metallist203 opened 2 months ago
Apologies for the delayed reply; I've been busy with work.
The email sending functionality can involve two layers:
Infrastructure Layer: This layer is responsible for interacting with external services like SMTP servers. It handles the technical details of external systems, such as sending emails using aiosmtplib.
Interface Adapters Layer: This layer encapsulates the logic for sending emails, converting application requirements into operations on the infrastructure layer. It defines abstract interfaces.
Based on my experience, I use a folder dedicated to external services:
adapters
/mail.py
class MailAdapter:
def __init__(self, *args, **kwargs):
...
def send_mail(self, *args, **kwargs):
...
* If there's a need to configure SMTP
settings, I might handle it in infrastructure/mail.py
or core/mail.py
.
* Naming Issue: For the adapters
, I've previously used names like service, adapter, or gateway. Ultimately, our team settled on using adapter based on our preferences.
Hello, i'm developing my project, witch i using aiosmtplib. How i can use this library in clean architecture? Do you have any example?