domain.protocols.email_service_protocol¶
src.domain.protocols.email_service_protocol
¶
EmailServiceProtocol - Domain protocol for email operations.
This protocol defines the interface for sending emails. Infrastructure provides concrete implementations (Stub, AWS SES, etc.).
Following hexagonal architecture: - Domain defines what it needs (protocol/port) - Infrastructure provides implementation (adapter) - Application layer uses protocol, not concrete implementation
Classes¶
EmailServiceProtocol
¶
Bases: Protocol
Protocol for email sending operations.
Defines the contract that all email service implementations must satisfy. Used for sending verification emails, password reset emails, etc.
Implementations
- StubEmailService: src/infrastructure/email/stub_email_service.py (dev/test)
- SESEmailService: src/infrastructure/email/ses_email_service.py (production)
Source code in src/domain/protocols/email_service_protocol.py
Functions¶
send_verification_email
async
¶
Send email verification email.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
to_email
|
str
|
Recipient email address. |
required |
verification_url
|
str
|
Full URL with verification token. |
required |
Source code in src/domain/protocols/email_service_protocol.py
send_password_reset_email
async
¶
Send password reset email.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
to_email
|
str
|
Recipient email address. |
required |
reset_url
|
str
|
Full URL with password reset token. |
required |
Source code in src/domain/protocols/email_service_protocol.py
send_password_changed_notification
async
¶
Send notification that password was changed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
to_email
|
str
|
Recipient email address. |
required |