mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-19 05:54:08 +02:00
24 lines
1.0 KiB
Python
24 lines
1.0 KiB
Python
import media_manager.notification.utils
|
|
from media_manager.notification.schemas import MessageNotification
|
|
from media_manager.notification.service_providers.abstractNotificationServiceProvider import \
|
|
AbstractNotificationServiceProvider
|
|
from media_manager.notification.config import NotificationConfig
|
|
|
|
class EmailNotificationServiceProvider(AbstractNotificationServiceProvider):
|
|
def __init__(self):
|
|
self.config = NotificationConfig()
|
|
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>
|
|
"""
|
|
media_manager.notification.utils.send_email(subject=subject, html=html,addressee=self.config.email)
|
|
return True |