1

I send email through codeigniter, and the hotmail recipients receive an email that seems empty.enter image description here

But if you show the source, the body is complete :

    x-store-info:sbevkl2QZR7OXo7WID5ZcdV2tiiWGqTnL8LqRHZDpO1a6RfqJUb9Bvk56X3BJKAg6cjaVhmE0UEtHLPiBFT8cnf1LZrSPERjUEe8skwDm3KAgvehRwVK6+cJhj4xrCbMEtL9MZV6cCY=
Authentication-Results: hotmail.com; sender-id=pass (sender IP is 89.31.151.18) header.from=webmaster@biocoupons.fr; dkim=none header.d=biocoupons.fr; x-hmca=pass
X-SID-PRA: webmaster@biocoupons.fr
X-DKIM-Result: None
X-Message-Status: n:0:n
X-SID-Result: Pass
X-AUTH-Result: PASS
X-Message-Delivery: Vj0xLjE7dXM9MDtsPTA7YT0wO0Q9MTtHRD0xO1NDTD0w
X-Message-Info: NhFq/7gR1vRbK5wwd2CCPiz2FoG/apC9Nlwn9QDQUkFtCAY0+3pBZaTO9tRcEil5WQ1UlFPTmVO6YI0VFRvEqJtfBxGnyrZjARsdKFYGzasctOU2tO5XGDWuESbcCr0Hq4XO6B1tyQE=
Received: from brunetprod.nexen.net ([89.31.151.18]) by SNT0-MC3-F43.Snt0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4900);
     Tue, 15 May 2012 23:44:54 -0700
Received: by brunetprod.nexen.net (Postfix, from userid 33)
    id 9DB1030C00A; Wed, 16 May 2012 08:44:53 +0200 (CEST)
To: ecolehaiti@live.fr
Subject: =?utf-8?Q?Vous_avez_oubli=c3=a9_votre_mot_de_passe_sur_Bio_Coupons=3f?=
X-PHP-Script: www.biocoupons.fr/index.php/auth/forgot_password for 81.56.219.94
User-Agent: CodeIgniter
Date: Wed, 16 May 2012 08:44:53 +0200
From: "Bio Coupons" <webmaster@biocoupons.fr>
Reply-To: "Bio Coupons" <webmaster@biocoupons.fr>
X-Sender: webmaster@biocoupons.fr
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <4fb34ce591593@biocoupons.fr>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_4fb34ce59161d"
Return-Path: webmaster@biocoupons.fr
X-OriginalArrivalTime: 16 May 2012 06:44:54.0956 (UTC) FILETIME=[671596C0:01CD332F]

This is a multi-part message in MIME format.
Your email application may not support this format.

--B_ALT_4fb34ce59161d
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Bonjour,

Vous avez perdu votre mot de passe ? Pas de panique. 
Pour créer un nouveau mot de passe, cliquez sur le lien suivant :

http://www.biocoupons.fr/auth/reset_password/
Vous recevez cet email à la demande d'un utilisateur de Bio Coupons . C'est
une étape de la création d'un nouveau mot de passe sur le site. Si vous
N'AVEZ PAS demandé un nouveau mot de passe, merci d'ignorer cet email, et
votre mot de passe restera inchangé.

Merci,
L'équipe Bio Coupons


--B_ALT_4fb34ce59161d
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html>
<head><title>Création d'un nouveau mot de passe sur Bio Coupons</title></h=
ead>
<body>
<div style=3D"max-width: 800px; margin: 0; padding: 30px 0;">
<table width=3D"80%" border=3D"0" cellpadding=3D"0" cellspacing=3D"0">
<tr>
<td width=3D"5%"></td>
<td align=3D"left" width=3D"95%" style=3D"font: 13px/18px Arial, Helvetica,=
 sans-serif;">
<h2 style=3D"font: normal 20px/23px Arial, Helvetica, sans-serif; margin: 0=
; padding: 0 0 18px; color: black;">Créer un nouveau mot de passe</h2>
Vous avez perdu votre mot de passe ? Pas de panique. <br />
Pour créer un nouveau mot de passe, cliquez sur le lien suivant :<br />
<br />
<big style=3D"font: 16px/18px Arial, Helvetica, sans-serif;"><b><a href=3D"=
http://www.biocoupons.fr/auth/reset_password/" style=3D"color: #3366cc;">Créer un nouveau mot de passe</a></b></=
big><br />
<br />
Le lien ne marche pas ? Copiez le lien suivant dans la barre d'adresse de v=
otre navigateur :<br />
<nobr><a href=3D"http://www.biocoupons.fr/auth/reset_password/" style=3D"color: #3366cc;">http://www.biocoupons.f=
r/auth/reset_password/</a></nobr><br /=
>
<br />
<br />
Vous recevez cet email à la demande d'un utilisateur de <a href=3D"http://=
www.biocoupons.fr/" style=3D"color: #3366cc;">Bio Coupons</a>. C'est une é=
tape de la création d'un nouveau mot de passe sur le site. Si vous N'AVEZ =
PAS demandé un nouveau mot de passe, merci d'ignorer cet email, et votre m=
ot de passe restera inchangé.<br />
<br />
<br />
Merci,<br />
L'équipe Bio Coupons</td>
</tr>
</table>
</div>
</body>
</html>

--B_ALT_4fb34ce59161d--

The other mailer display the email fine. I try with and without doctype.

The rendered HTML :

    <div id="mpf0_readMsgBodyContainer" class="ReadMsgBody" onclick="return Control.invoke('MessagePartBody','_onBodyClick',event,event);">
        <div class="SandboxScopeClass ExternalClass" id="mpf0_MsgContainer"></div>

And the rendered html of a correct email (a text one)

    <div id="mpf0_readMsgBodyContainer" class="ReadMsgBody" onclick="return Control.invoke('MessagePartBody','_onBodyClick',event,event);">
    <div class="SandboxScopeClass ExternalClass PlainTextMessageBody ContentFiltered" id="mpf0_MsgContainer">
        <pre>Bonjour,<br>Vous venez de vous inscrire à Bio Coupons et nous vous en remercions.<br> 
        </pre>
    </div>
</div>

As you can see, the message body div is not filled at all. I suspect a javascript problem, but why it's occuring on my email ? Thanks for your help

Matthieu
  • 563
  • 1
  • 7
  • 25
  • Can you include the rendered HTML from the Hotmail page. If you look at the rendered HTML it may become more apparent where the problem lies in your original HTML. – RidingTheRails May 16 '12 at 07:12
  • I find the HTML with the web inspector. But as you can see, it seems empty – Matthieu May 16 '12 at 08:00
  • I've run it through http://www.motobit.com/util/quoted-printable-decoder.asp and the HTML looks OK at a glance and renders ok in chrome. One suggestion would be to try removing the style information to see if that has any effect and if not then go back to basics and reduce the HTML down to one element e.g. one DIV with some text and build it an element at a time to see where the problem creeps in and it stops rendering. – RidingTheRails May 16 '12 at 08:24
  • I guess it's the only solution. I was hoping there was some known problem with hotmail... (I know : there is a lot of known problem with hotmail ;+) – Matthieu May 16 '12 at 13:59

2 Answers2

3

It was only lacking a new line at the top of the html code. i.e. :

--B_ALT_4fb34ce59161d
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable


<html>
...

Instead of

--B_ALT_4fb34ce59161d
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html>
...

curious, isn't it ?

Matthieu
  • 563
  • 1
  • 7
  • 25
  • 1
    I'm lucky to have found it, because I'd never thought of testing it, but in my process of removing each tag one after another, I once left a blank line. I first thought the fix came from the tag I just removed, but when I tried again without leaving the blank line, it didn't work ! so by comparing the two emails, I saw the added blank line in the working one... Who is responsible for this hotmail crap ? don't tell me... it begins with a "m"... – Matthieu May 16 '12 at 18:09
1

We ran into this in our web app, and I found that CSS comments were the culprit in our environment. After trying the above solutions with no success, I began dissecting our HTML templates line by line, section by section.

In our environment we use PreMailer.net (https://github.com/milkshakesoftware/PreMailer.Net) to inline our CSS styles from a normal stylesheet and inject it into the HTML email templates via partials. In those partial CSS files, there were CSS comments. When I removed those, the emails rendered properly in the outlook.com web client (which also provides mail service for @hotmail and @live accounts).

In our app, I changed the CSS comments from /* */ to server side comments @* *@ (we're using razor syntax for our .NET MVC 4 app) and that did the trick.

dlane
  • 1,131
  • 7
  • 7
  • 1
    Just ran into this issue - turned out to be caused by a CSS comment containing HTML. The rest of the CSS comments didn't cause an issue in this case. – Stecman Jul 01 '14 at 02:30