Files
MediaManager-maxdorninger-1/media_manager/notification/service_providers/email.py
Maximilian Dorninger a39e0d204a Ruff enable type annotations rule (#362)
This PR enables the ruff rule for return type annotations (ANN), and
adds the ty package for type checking.
2026-01-06 17:07:19 +01:00

33 lines
1.1 KiB
Python

import media_manager.notification.utils
from media_manager.config import MediaManagerConfig
from media_manager.notification.schemas import MessageNotification
from media_manager.notification.service_providers.abstract_notification_service_provider import (
AbstractNotificationServiceProvider,
)
class EmailNotificationServiceProvider(AbstractNotificationServiceProvider):
def __init__(self) -> None:
self.config = MediaManagerConfig().notifications.email_notifications
def send_notification(self, message: MessageNotification) -> bool:
subject = "MediaManager - " + message.title
html = f"""\
<html>
<body>
<br>
{message.message}
<br>
<br>
This is an automated message from MediaManager.</p>
</body>
</html>
"""
for email in self.config.emails:
media_manager.notification.utils.send_email(
subject=subject, html=html, addressee=email
)
return True