Skip to content

Commit

Permalink
Merge pull request #21 from techx/gaurab
Browse files Browse the repository at this point in the history
Fixed the new line formatting issue
  • Loading branch information
azliu0 authored May 4, 2024
2 parents b255088 + e5ad017 commit 8b9fab8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/controllers/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,11 @@ def send_email():
).scalar()
if not thread:
return {"message": "Thread not found"}, 400

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

0 comments on commit 8b9fab8

Please sign in to comment.