Do I need to include html, head and body tags when creating HTML emails?
P粉764836448
P粉764836448 2023-10-17 16:56:57
0
1
568

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粉764836448
P粉764836448

reply all(1)
P粉489081732

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.
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!