[GH-ISSUE #488] HtmlFormatter dies not include document type and <html> tag #170

Closed
opened 2026-03-04 02:12:49 +03:00 by kerem · 1 comment
Owner

Originally created by @dnlbauer on GitHub (Dec 30, 2014).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/488

At the moment, the html formatter returns the plain html table starting with the <table> tag. This is fine for most email programms.

Unfortunatly there are also some programs that wont render this correctly. Android's gmail app, for example, will show an empty mail with a file attachment named something like "-38". Its not possible to display that file as html at all on a phone.

To change that, proper html declaration must be given I think. The table should be wrapped with something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">     
<html xmlns="http://www.w3.org/1999/xhtml">    
    <head>     
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />     
        <title>some text</title>     
    </head>     
    <body>     
        PUT CONTENT HERE     
    </body>     
</html>```
Originally created by @dnlbauer on GitHub (Dec 30, 2014). Original GitHub issue: https://github.com/Seldaek/monolog/issues/488 At the moment, the html formatter returns the plain html table starting with the `<table>` tag. This is fine for most email programms. Unfortunatly there are also some programs that wont render this correctly. Android's gmail app, for example, will show an empty mail with a file attachment named something like "-38". Its not possible to display that file as html at all on a phone. To change that, proper html declaration must be given I think. The table should be wrapped with something like this: `````` <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>some text</title> </head> <body> PUT CONTENT HERE </body> </html>``` ``````
kerem 2026-03-04 02:12:49 +03:00
  • closed this issue
  • added the
    Bug
    label
Author
Owner

@Seldaek commented on GitHub (Mar 1, 2015):

Unfortunately the problem is records are formatted individually, so this would have to be done at a higher level in the handler itself before sending the email.

<!-- gh-comment-id:76601011 --> @Seldaek commented on GitHub (Mar 1, 2015): Unfortunately the problem is records are formatted individually, so this would have to be done at a higher level in the handler itself before sending the email.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#170
No description provided.