From e5ad017f4db68aa992753cefa765d227f6612001 Mon Sep 17 00:00:00 2001 From: Gaurab Das~ Date: Sat, 27 Apr 2024 21:50:31 +0000 Subject: [PATCH] Fixed new line formatting in emails --- server/controllers/emails.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/controllers/emails.py b/server/controllers/emails.py index 5297c68f8..3fe50eece 100644 --- a/server/controllers/emails.py +++ b/server/controllers/emails.py @@ -371,8 +371,11 @@ def send_email(): ).scalar() if not thread: return {"message": "Thread not found"}, 400 + + # replace
with \n in body + breaked_line_text = data["body"].replace("
", "\n") clean_regex = re.compile("<.*?>") - clean_text = re.sub(clean_regex, " ", data["body"]) + clean_text = re.sub(clean_regex, " ", breaked_line_text) context = {"body": data["body"]} template = env.get_template("template.html") body = template.render(**context)