Private
Public Access
1
0

user messages work

This commit is contained in:
2023-11-02 13:37:49 +01:00
parent 6f1f426c69
commit 44b8efe4d8
8 changed files with 114 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
from django.contrib.staticfiles import finders
from bs4 import BeautifulSoup
import os
import time
import gc
@@ -112,17 +112,22 @@ def send_template_email(from_email, to_email, subject,
else:
emailbounced = False
try:
usr = User.objects.get(email=to_email)
umsg = UserMessage(
receiver = usr.rower,
datetime = timezone.now(),
text = text_content,
subject=subject,
)
umsg.save()
except User.DoesNotExist:
pass
for recipient in to_email:
try:
soup = BeautifulSoup(html_content)
s2 = soup.body
usr = User.objects.get(email=recipient)
umsg = UserMessage(
receiver = usr.rower,
datetime = timezone.now(),
text = '{text}'.format(text=s2),
subject=subject,
)
umsg.save()
except User.DoesNotExist:
pass
if not emailbounced:
res = msg.send()