Skip to content

Commit

Permalink
Fixed the new line formatting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurab1 committed Apr 27, 2024
1 parent 5e3d3ee commit ad22590
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/controllers/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,10 @@ def send_email():
).scalar()
if not thread:
return {"message": "Thread not found"}, 400

breaked_line_text = data["body"].replace("<br/>", "\n") # replace <br /> with \n in body
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)
Expand Down

0 comments on commit ad22590

Please sign in to comment.