The various email templates are in HTML files, but when they are sent, they are not sent in a way which that signals a receiving client to render them as HTML. There's also some code that pulls text out of <p> tags, which kind of undoes the HTML. See
|
p_tags= soup.find_all('p') |
|
|
|
new_story= [re.sub(r'\s+', ' ', p.get_text(strip=True)) for p in p_tags if p.get_text(strip=True)] |
(I also wonder if the <ul> content of some email templates comes through that process looking as we'd like it to.)
We could change the templates to be plain text, although formatting lists in ASCII is a pain; or we could use more advanced methods of the python email.message library to send the email as HTML, which is a different kind of a pain.
But if we are sending the messages as text, we should use text templates, and not HTML templates with a custom process for reducing the templates to plain text.
The various email templates are in HTML files, but when they are sent, they are not sent in a way which that signals a receiving client to render them as HTML. There's also some code that pulls text out of
<p>tags, which kind of undoes the HTML. Seeweatherbot/NHC.py
Lines 322 to 324 in 54eefc2
(I also wonder if the
<ul>content of some email templates comes through that process looking as we'd like it to.)We could change the templates to be plain text, although formatting lists in ASCII is a pain; or we could use more advanced methods of the python
email.messagelibrary to send the email as HTML, which is a different kind of a pain.But if we are sending the messages as text, we should use text templates, and not HTML templates with a custom process for reducing the templates to plain text.