hteumeuleu / caniemail

Can I email… Support tables for HTML and CSS in emails.
https://www.caniemail.com
MIT License
806 stars 69 forks source link

Seeking clarification on "HTML <body> feature is unsupported" error #432

Open kdipippo opened 4 months ago

kdipippo commented 4 months ago

Hello! I've been using the results of this repo in combination with a downstream CLI tool https://github.com/shellscape/doiuse-email that relies on the "API" data to perform linting on some HTML templates.

My main consumers will be OutLook email clients. My email templates are currently structured with:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <meta content="text/html charset=UTF-8" http-equiv="Content-Type"/>
  </head>
  <body>
    ... email content ...
  </body>
</html>

If I run this against the doiuse-email linter, I get the errors:

- `<body> element` is not supported by `outlook.macos`
- `<body> element` is not supported by `outlook.ios`
- `<body> element` is not supported by `outlook.android`

This correctly reflects the entries in this file: https://github.com/hteumeuleu/caniemail/blob/3c2b1e438dbdd0e7f7ed6d05eac618d075dd361e/_features/html-body.md?plain=1#L42

...where values for these booleans were confirmed by creating emails with this content: https://github.com/hteumeuleu/caniemail/blob/main/tests/html-body.html

I have access to OutLook for MacOS 16.82.1, and I was curious to see what this test validates.

Screenshot of html-body.html in Chrome browser ![image](https://github.com/hteumeuleu/caniemail/assets/7936720/fa6906e9-d640-451c-ad94-94747486dd43)
Screenshot of html-body.html in my OutLook Mac 16.82 inbox sent using Python3 smtplib's sendmail() image

Apologies if these are basic questions. But what do these tests mean? Is the fact that the OutLook email screenshot not having a yellow background indicate that color styling can't be applied? What alternative does OutLook need to use in place of <body> or is it just I can't have styling attributes applied to it? I'm also thrown by what the Chrome screenshot shows, but that may be because the test is built for emails-only and not for browser previewing.

hteumeuleu commented 4 months ago

Hello! In this exact case, this means the Outlook email clients replace the <body> element by another element (in this case, a <div>). But this makes me realize that the values are not very consistent here as the Not supported values here should probably be more a Partial support (with the first note appended). Would that make more sense?