#7706 closed defect (bug) (fixed)
Using nl2br for Email content adds unwanted br tags
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Emails | Keywords: | reporter-feedback |
Cc: | chris.p.herbst@… |
Description
When including markup in the email body, e.g. tables these are usually saved by the wordpress editor with newlines after each tag. These newlines get converted by nl2br to br tags. As br tags are not allowed between e.g. <tr> and <td> tags these get pulled in front of the table by most browsers and email clients. This leads to a lot of br tags in front of the table and thus an unusual bog amount of white space.
The attached patch uses the wordpress function wpautop instead of nl2br which replaces newlines with paragraphs and does not replace newlines inside HTML tags.
Attachments (1)
Change History (7)
#1
@
7 years ago
- Keywords reporter-feedback added
- Milestone changed from Awaiting Review to Under Consideration
#2
@
7 years ago
We are using the standard email template. The Bug occures e.g. with the following email content:
Below this text many br tags are generated: <table> <thead> <tr> <th>Heading1</th> <th>Heading2</th> </tr> </thead> <tbody> <tr> <td>Content1</td> <td>Content2</td> </tr> </tbody> </table>
If you're using a custom email template, can you upload that so I can test with it?
Otherwise, can you find the relevant email post type in the database, and copy out the
post_content
into a text file and share here?This way, I can recreate easily what you're seeing. Ta.