Skip to content

Email templates are in HTML, but are not sent as HTML #4

@JoeGermuska

Description

@JoeGermuska

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

weatherbot/NHC.py

Lines 322 to 324 in 54eefc2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions