1

I generate and send an email with text/html content. General structure:

<!DOCTYPE html>
<html>
<head>
    <title>{title}</title>
    <style type="text/css">
        {% block stypes %}
        {% endblock %}
    </style>
</head>
<body>

    {% block content %}
    {% endblock %}

</body>

In my email box, I received properly generated the email (html/css works as expected). But when I forward the message it seems that <styles> tag is removed. Is it possible to retain css styles on forwarding?

Oleksandr Yarushevskyi
  • 2,789
  • 2
  • 17
  • 24
  • Forwarding formatted and styled html emails just tends to break the formatting. Not much you can do about it, it's a problem with how forwarding works. – Lee A. Feb 23 '18 at 15:13
  • 2
    AFAIK your best route is to inline your CSS rules circa 1995 – j08691 Feb 23 '18 at 15:13
  • code like it's the 90s, no padding no margins, no head css or js, just inline css and tables within tables within tables within tables – treyBake Feb 23 '18 at 15:14
  • oh I understood, thank you – Oleksandr Yarushevskyi Feb 23 '18 at 15:38
  • I also discovered that some property in inline CSS also removed, such as `float,` `background-color.` – Oleksandr Yarushevskyi Feb 23 '18 at 15:41
  • If you are using a compiler to generate your HTML (moving CSS inline) then chances are that compiler is old. It's best to use one that works. Float will not work on all email clients (specially Outlook) but background color should work. – Syfer Feb 26 '18 at 07:32

1 Answers1

2

Forwarded mail dosnt hold the same styles as the original html/css. The mail client will add and remove a lot og styles in your code..

What you can do is to Attach the mail to another mail, then the format will hold.

Bidstrup
  • 1,597
  • 2
  • 16
  • 32