search

Home  >  Q&A  >  body text

Do I need to include html, head and body tags when creating HTML emails?

In my email view I usually just do something like this

<dl>
   <dt>Name</dt>
   <dd>Value</dd>
</dl>

Should I do this?

<html>
  <head></head>
  <body>
    <dl>
       <dt>Name</dt>
       <dd>Value</dd>
    </dl>
  </body>
</html>

In other words, it's like I'm marking up a separate document?

I think I can safely assume that any web-based email client will remove it?

What is the correct approach?

P粉764836448P粉764836448409 days ago635

reply all(1)I'll reply

  • P粉489081732

    P粉4890817322023-10-18 00:42:21

    The correct way is to follow the HTML standard. You can verify your HTML page here.

    Your mail client should follow it and should discard unsupported or unsafe content, such as JavaScript.

    I will reveal some of the reasons why the following standards may be beneficial:

    1. Webmail that prefers to display your message as a full page can preserve your formatting.
    2. Webmail will only remove tags and attributes it doesn't need. But you never know which ones.
    3. It is easier to find (server-side) components that follow format standards and therefore are less prone to errors. Parsers that don't follow the standards may crash, preventing your email from being displayed.

    reply
    0
  • Cancelreply