> > > Now when I send the emails I of course want to send both text content and > HTML. My idea from the beginning was to take my HTML content and strip the > HTML tags and then send that. I did this via the django utils that strip > tags. Now this works, HOWEVER I don't get any newlines for my <br> and > <p></p> tags. > > I was wondering if anyone has had any similar issues and has found a good > solution? What I want to do is strip all of the html tags and at the same > time replace the <br> and <p></p> tags. >
Why not regex substitute all of the tags you listed with newlines before stripping the HTML out? I say use regex because you can do things like specify multiple tags and account for things like case sensitivity. I would also look at a Python HTML to plain text conversion library, something like this: https://github.com/aaronsw/html2text/blob/master/README.md Never needed something like this, but looks interesting. -James > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVF2nFyF%2BfH74vaeYtFutsmdCxjtMf%3D9JhcHNrRD5njdg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

