Rendering of e-mail template adds unnecessary whitespace


(Valentin Churavy) #1

I have the following e-mail template:

%{message}

%{context}

%{respond_instructions}

Which in turn creates the following e-mail

----==_mimepart_59121ceab749e_713fcbab014f1c98278
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<p><div style='margin-left: 15px'><br>[text]</p>

<p>[text]</p>

<p></div></p>

<hr>

<p><a href="[link]">Visit Topic</a> or reply to this email to respond.</p>

<p>You are receiving this because you enabled mailing list mode.</p>

<p>To unsubscribe from these emails, <a href="[LINK]">click here</a>.</p>
----==_mimepart_59121ceab749e_713fcbab014f1c98278--

The <div style='margin-left: 15px'> creates an unnecessary whitespace indentation and seems odd in itself.

CC: @yuyichao


(Jeff Atwood) #2

I assume you are objecting to the suppression of avatar in single short email notifications? This was done to satisfy Spam Assassin rules where small emails with images are penalized.


(Valentin Churavy) #3

No, I disabled the header because a user asked for it and we wanted to make the mailing-list experience more mailinglist like :wink:

My issue is that the first paragraph is indented and that makes it look like it might be a citation (which it is not). Looking at the raw html of the e-mail there is a spurious <div style='margin-left: 15px'>.


(Jeff Atwood) #4

Oh I see @neil can you have a look?


(Neil Lalonde) #6

Yeah I see the problem.

result.gsub!(/\[email-indent\]/, "<div style='margin-left: 15px'>")
result.gsub!(/\[\/email-indent\]/, "</div>")

That will create some mangled html.


(Neil Lalonde) #7

Fixed.

Looks like there was old code trying to indent posts, and it probably worked great… for two days in 2013. This commit became obsolete two days later by this commit when a custom html template was used instead of the markdown. Now we allow customized email templates to be used for HTML, which unearthed this archaeological treasure.


(Jeff Atwood) #8

archaeological “treasure”


(Neil Lalonde) #9