milkshakesoftware/PreMailer.Net

Simple e-mail not rendered by gmail after applying PreMailer.net

Closed this issue · 3 comments

I am using version 2.0.0-beta2 from Nuget on netcoreapp2.0 in the console on Windows.

I have a simple HTML markup like so:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <style type="text/css">
        body {
            margin: 0;
            padding: 0;
            min-width: 100% !important;
        }

        .content {
            width: 100%;
            max-width: 600px;
        }
    </style>
</head>
<body yahoo bgcolor="#f6f8f1">
<table width="100%" bgcolor="#f6f8f1" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td>
            <table class="content" align="center" cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td>
                        shoes
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
</body>
</html>

When i pass it through premailer using this code:

var pm = new PreMailer.Net.PreMailer(s);
            var resx = pm.MoveCssInline();

            var newHtml = resx.Html;

The newHtml contains:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html lang="en" xmlns="http://www.w3.org/1999/xhtml"><head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title />
    <style type="text/css">
        body {
            margin: 0;
            padding: 0;
            min-width: 100% !important;
        }

        .content {
            width: 100%;
            max-width: 600px;
        }
    </style>
</head>
<body yahoo="" bgcolor="#f6f8f1" style="margin: 0;padding: 0;min-width: 100% !important">
<table width="100%" bgcolor="#f6f8f1" border="0" cellpadding="0" cellspacing="0">
    <tbody><tr>
        <td>
            <table class="content" align="center" cellpadding="0" cellspacing="0" border="0" style="width: 100%;max-width: 600px">
                <tbody><tr>
                    <td>
                        shoes
                    </td>
                </tr>
            </tbody></table>
        </td>
    </tr>
</tbody></table>

</body></html>

Online Gmail can't render this result, i.e. the whole view is blank:
image

The HTML is definitely delivered:
image

erzki commented

Have you found the issue here? I have the same when upgrading from Premailer.Net 1.5.3 which is working to 1.5.5.

Have you tried latest version?

erzki commented

I solved it.
The problem is that versions after 1.5.3 changes emtpy title tag to <title />
For some reason this renders as empty mail in Gmail.