Welcome Guest, Not a member yet? Register   Sign In
HTML emails sent as plain text
#1

[eluser]Billy Khan[/eluser]
I am trying to send a html email, the problem is that in google mail, the email displays the html rather than rendering it.

I have mailtype set to html.

this is what the debugger prints:

Your message has been successfully sent using the following protocol: mail

Code:
User-Agent: CodeIgniter
Date: Thu, 10 Sep 2009 15:42:10 +0100
From: "Order Details"
Return-Path:
Reply-To: "###"
X-Sender: ###
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <###>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_4aa910422ad94"
This is a multi-part message in MIME format.
Your email application may not support this format.

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

This is the alternative message


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

&lt;html&gt;
&lt;head&gt;
&lt;title&gt;My Page&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
hello
&lt;/body&gt;
&lt;/html&gt;


--B_ALT_4aa910422ad94--

and my email displays

Code:
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;My Page&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
hello
&lt;/body&gt;
&lt;/html&gt;

Any ideas?
#2

[eluser]bretticus[/eluser]
Looks like you have alternative message set:

Code:
$this->email->set_alt_message('This is the alternative message');

Remove that line. Gmail is showing the plain text part for you. Not sure it that's the default or what, but that appears to be your problem.

EDIT: Ah, sorry. I see now that the HTML part is showing as plain text. That's strange considering the mime type clearly shows text/html. Hmmm...
#3

[eluser]BrianDHall[/eluser]
I can't tell that anything is wrong with that from what you posted. If nothing else you might try CodeIgniter's Email Class which supports sending mail as HTML. Might try a hello world example with that and see if you get the same problem - if not maybe you can go backwards from there to see what is different...or just pretend it never happened and use the CI class Wink

If that doesn't work I would think perhaps a problem with the sendmail setup, maybe having a default to text somewhere - but odd that the MIME seems right. Does this do this if you access it from other email clients, or just google?
#4

[eluser]Billy Khan[/eluser]
Forgot to mention, this is using CI class.
#5

[eluser]sophistry[/eluser]
what is "TEST SUBJECT" doing in your HTML?
#6

[eluser]Billy Khan[/eluser]
That is the email subject.
#7

[eluser]sophistry[/eluser]
yes, it is IN the HTML though. why?
#8

[eluser]mattthehoople[/eluser]
Is it just in gmail that it fails to render? It may be your server set up... It does say...

"Content-Type: multipart/alternative; boundary="B_ALT_4aa910422ad94"
This is a multi-part message in MIME format.
Your email application may not support this format."

Perhaps your email application doesn't support this format?
#9

[eluser]Billy Khan[/eluser]
Managed to sort it. An CI upgrade. Cant see in the change notes what was done to fix it.
Needless to say, all is well. Thanks for your help.
#10

[eluser]bretticus[/eluser]
I saw something on a google mail help forum somewhere today about the boundary line needing to be indented for a multipart. No idea really, but that's a possibility I suppose.




Theme © iAndrew 2016 - Forum software by © MyBB