View Issue Details

IDProjectCategoryView StatusLast Update
0023462Plugin - EmailReportingGeneralpublic2026-10-21 14:34
Reporterlibregeek Assigned ToSL-Gundam  
PrioritynormalSeveritymajorReproducibilitysometimes
Status resolvedResolutionfixed 
Summary0023462: Forwarded HTML mails are saved without the email body
Description

Forwarded HTML mails especially sent from bulk email applications are cut off. In most cases the body is completely removed, but in some cases certain sections are saved into description. Please see the screenshot.

However, HTML mails composed from gmail/outlook or any other email clients works perfectly.

TagsNo tags attached.
Attached Files
Selection_606.png (31,307 bytes)   
Selection_606.png (31,307 bytes)   

Activities

SL-Gundam

SL-Gundam

2017-10-11 12:18

manager   ~0057940

Are you using more (|) characters to separate signatures from emails so that they are not imported into the issue?
https://www.mantisbt.org/wiki/doku.php/mantisbt:emailreporting#mail_strip_signature_delim

SL-Gundam

SL-Gundam

2017-10-11 12:37

manager   ~0057941

Last edited: 2017-10-11 12:38

If the above is not applicable then it seems that markdownify is failing at converting this email.

Based on the html this email is also quite complex. markdownify is only meant for simple html emails and can convert basic spreadsheet formatted tables. Newsletters and stuff like this are often quite complex because companies want them to look nice and use tables for the layout. markdownify can not deal with this properly

Just this alone at the end should tell you enough want kind of stuff is in this email:
</div>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</div>

Do you have any good ideas on how we want EmailReporting to deal with this issue?

SL-Gundam

SL-Gundam

2017-10-11 12:41

manager   ~0057942

One idea

Setting https://github.com/mantisbt-plugins/EmailReporting/blob/master/core/Mail/Parser.php#L437
to TRUE

But i'm unsure on what the results will be on other htm content.

libregeek

libregeek

2017-10-12 01:52

manager   ~0057945

@sl-gundam The signature delimiter I used is --. The email I forwarded doesn't have a signature on the top. So I guess it may not be the issue.

I too believe that it's the limitation in markdownify and I also agree with you on the dirty formatting in Newsletters. One probable solution is to get the plain text (without formatting) whenever markdownify fails to get the content. However, I couldn't figure out how to check the failure since it always has some content. This is kind of a complicated case...

SL-Gundam

SL-Gundam

2017-10-13 05:23

manager   ~0057956

How about we check with a regex whether there exists a table within a table in the html code

If it exists the email is considered complex and will fallback to plaintext

SL-Gundam

SL-Gundam

2026-10-21 14:34

manager   ~0071521

I made changes to Markdownify. Nested tables are now ignored. Everything should work better with EmailReporting 0.12.0 and later versions