Welcome Guest, Not a member yet? Register   Sign In
Email class - body stripped in outlook 2003
#1

[eluser]Skinnpenal[/eluser]
hi Smile

I've got a weird problem with html emails sent with the email class, when viewing them in outlook 2003. The contents is simply not there. When viewing the source I see that everything from </head> and down has been stripped from the email. When I view the email in f.ex. my webmail, everything is ok.

Any ideas what's going on?

I've read around on the net and found a few possible related stuff, but I can't make sense of it.. like this post on blogs.msdn.com

Another theory is that it is newline related. The webserver is on linux (\n), outlook is on windows (\r\n).. and the html template is written on a mac (\r). So if newlines of the template etc. matters, I guess I'm trouble.

Any ideas?
#2

[eluser]Jilani Jidni[/eluser]
can you send the email body text. I will suggest not to use &lt;html&gt;, &lt;head&gt; and &lt;body&gt; tag into the email body. just start from the <table>. try this it may be help you.
#3

[eluser]Skinnpenal[/eluser]
Thanks for the reply Smile

I tried doing what you said, with having only the contents of the body in the email, and that makes it work. But that's sort of limiting when it comes to styling etc..

I have other html email's that works fine in outlook, even though they have full html, so it's a bit weird that I can't achieve the same thing.

When I view the source of the email in outlook, this is how it looks:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

&lt;html &gt;

    &lt;head&gt;
        &lt;title&gt;This is the subject&lt;/title&gt;

        &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
        &lt;meta http-equiv="Content-language" content="no-bokmaal" /&gt;

    &lt;/head&gt;

This is the full source of the email, as viewed in Apple's Mail.app (sorry about the long length):
Code:
Return-Path: <email>
Received: from email ([213.236.233.33])
    by mx01.email (8.14.1/8.14.1) with ESMTP id m6UACYCX006957
    for <email>; Wed, 30 Jul 2008 12:12:35 +0200
Received: by email (Postfix, from userid 48)
    id 1C4E7155E68; Wed, 30 Jul 2008 20:09:44 +0200 (CEST)
To: email
Subject: This is the subject
User-Agent: Php
Date: Wed, 30 Jul 2008 20:09:44 +0200
From: "email" <email>
Reply-To: "email" <email>
X-Sender: email
X-Mailer: Php
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_4890ae68157e7"
X-Spam-Status: No, hits=0.0 required=4.0
X-Virus-Scanned: by moam (http://www.moam.net/)
X-Moam-Version: 0.93

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

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

This is the message body


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

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

&lt;html &gt;

    &lt;head&gt;
        &lt;title&gt;This is the subject&lt;/title&gt;

        &lt;meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8" =
/&gt;
        &lt;meta http-equiv=3D"Content-language" content=3D"no-bokmaal" /&gt;

    &lt;/head&gt;

=00
    &lt;body&gt;

        <p>This is the <strong>message</strong> body</p>

    &lt;/body&gt;

&lt;/html&gt;

--B_ALT_4890ae68157e7--
#4

[eluser]Jilani Jidni[/eluser]
Hi Skinnpenal

Sorry I could not understand your problem can you please send me the mail sending code and also the screen shot of output of the main in outlook 2003.
#5

[eluser]andreagam[/eluser]
Hi Skinnpenal,

I experienced a similar issue some time ago, and I ended up thinking that some characters resulting in the email text were non well accepted by Outlook.

So I wrote a simple little helper to filter the text string before sending it.
This is it:
Code:
function outlookfilter($text)
{    
        $text = str_replace("<br />","<br>",$text);
        $text = str_replace("&nbsp;","",$text);
        $text = str_replace("'","'",$text);        

        return $text;
}

Hope it helps,
Andrea
#6

[eluser]Skinnpenal[/eluser]
Hi Andrea,

Your code fixes the issue - thanks a lot!

It also seems outlook doesn't have any default styles for <strong> and <em> tags so I added a str_replace to <b> and <i> as well.. so the email looks "descent" in it now. Seems that the css support in outlook is pretty lousy. Tongue

Thanks again Smile
#7

[eluser]andreagam[/eluser]
Quote:Seems that the css support in outlook is pretty lousy.

Sure it is. As stated by Microsoft, Outlook 2007 uses the parsing and rendering engine from... MS Word! :wow:
#8

[eluser]Skinnpenal[/eluser]
Doh! The problem is back.

I'm on a mac, using Coda as editor. If I save the html template for the email through this app, everything works fine in Outlook 2003.

However if the template is written on linux, it fails - meaning after a certain point in the email everything below is stripped (in outlook 2003).

The flow to replicate this is: copy html from Coda -> connect to webserver (fedora) through ssh -> open nano editor -> paste and save.

It seems there's some wordwrapping going on at this stage, so I was thinking that maybe linux inserts some newline characters or something that outlook doesn't understand. But I allready run this thing I found to also be in the email class:
Code:
$text = preg_replace("/\r\n|\r/", "\n", $text);

If it matters, this is the html template I'm currently trying out: [link]

In it, on the top, you can see "You are receiving this email because the email address [email] was subscribed to our email list. Having", and after "Having" everything is blank in outlook. This happens to be a 138 characters length line when saved in nano, which I think I've read somewhere is a pretty standard linelength limit for wordwraps.

This is however how the email class debugger outputs that section:
Code:
<p>You are receiving this email because the email address [email] was subsc=
ribed to our email list. Having trouble reading this email? View it on our =
<a >website</a>.</p>

Any ideas?
#9

[eluser]andreagam[/eluser]
If you look at the resulting source code of the mail, do you notice the string "=00" ?
That was, in my case, the string that made my mail truncated by Outlook...
I develop on Mac too, but don't understand why you edit the text consecutively on Linux...




Theme © iAndrew 2016 - Forum software by © MyBB