# Path: della/email_service/core.py
# def send_email(subject, message, recipient_list):
#     send_mail(
#         subject=subject,
#         message=message,
#         html_message=message.replace('\n', '<br />'),
#         from_email=settings.SENDER_EMAIL,
#         recipient_list=recipient_list,
#     )
# 
# Path: della/inbox/models.py
# class Message(TimeStampMixin):
#     text = models.TextField()
# 
#     sent_by = models.ForeignKey(User, on_delete=models.CASCADE)
#     thread = models.ForeignKey(Thread, on_delete=models.CASCADE,  related_name='messages')


from urllib.parse import urljoin
from django.conf import settings
from django.template.loader import render_to_string
from django.urls import reverse
from background_task import background
from della.email_service import send_email
from .models import Message
from . import inbox_service




@background(queue=settings.INBOX_EMAIL_NOTIFICATION_QUEUE)
def send_email_notification(message_id, base_site_url):
    message_template = 'inbox/message_notification_email.html'

# Path: della/email_service/core.py
# def send_email(subject, message, recipient_list):
#     send_mail(
#         subject=subject,
#         message=message,
#         html_message=message.replace('\n', '<br />'),
#         from_email=settings.SENDER_EMAIL,
#         recipient_list=recipient_list,
#     )
# 
# Path: della/inbox/models.py
# class Message(TimeStampMixin):
#     text = models.TextField()
# 
#     sent_by = models.ForeignKey(User, on_delete=models.CASCADE)
#     thread = models.ForeignKey(Thread, on_delete=models.CASCADE,  related_name='messages')


# Path: della/inbox/tasks.py
from urllib.parse import urljoin
from django.conf import settings
from django.template.loader import render_to_string
from django.urls import reverse
from background_task import background
from della.email_service import send_email
from .models import Message
from . import inbox_service





@background(queue=settings.INBOX_EMAIL_NOTIFICATION_QUEUE)
def send_email_notification(message_id, base_site_url):
    message_template = 'inbox/message_notification_email.html'

    message = Message.objects.select_related('thread').get(pk=message_id)