Thanks guys - I knew I could rely on getting good suggestions even in my
sleep :-)

@James: I was thinking about going with regexp, but my regexp fu isn't to
great - would take me too much time to sort through the regexp required.
However I am thinking about doing something along those lines anyway. I
will be looking into the html2text library you pointed out as well.

Regards,

Andréas

2018-04-18 6:27 GMT+02:00 James Schneider <[email protected]>:

>
>> 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
> <https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVF2nFyF%2BfH74vaeYtFutsmdCxjtMf%3D9JhcHNrRD5njdg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAK4qSCeDnhNosCoH3TffP_pLm5ZN7f2Ndh%2BS6rOrfqOVoQer%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to