Welcome Guest, Not a member yet? Register   Sign In
Troubles with HTML email
#1

[eluser]litzinger[/eluser]
I'm trying to send an HTML email, but it just isn't coming through as HTML in Entourage, although I have it set to show HTML. Below is the CI code I'm using, and below that is my output, sans the actual HTML for client confidentiality. The view I'm loading is just a simple table with some data, and I wrapped the message with the html and body tag b/c the view doesn't have these tags b/c it's an include used somewhere else too. It works fine if I send it to my gmail account, but not my Entourage account. What am I missing?

Code:
$config['mailtype'] = 'html';
$config['charset'] = 'UTF-8';
$this->email->initialize($config);
        
$message .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;head&gt;&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;&lt;/head&gt;';
$message .= '<p>'.$this->input->post('notes').'</p>';
$message .= $this->load->view('reporting/contact_detail_inc.php', $data, TRUE);
$message .= '&lt;/body&gt;&lt;/html&gt;';

$this->email->from('[email protected]', 'Me');
$this->email->to($this->input->post('email'));

$this->email->subject('Email Test');
$this->email->message($message);
$this->email->send();

echo $this->email->print_debugger();


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

User-Agent: Code Igniter
Date: Wed, 27 Jun 2007 08:17:14 -0500
From: "Me"
Return-Path:
Reply-To: "[email protected]"
X-Sender: [email protected]
X-Mailer: Code Igniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_4682635a99c71"
This is a multi-part message in MIME format.
Your email application may not support this format.

--B_ALT_4682635a99c71
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

///// THE RAW TEXT ////


--B_ALT_4682635a99c71
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted/printable
Email Test

///// MY HTML ////

--B_ALT_4682635a99c71--
[/code]
#2

[eluser]woopsicle[/eluser]
i am not familiar with Entourage - does it normally accept html emails?
i know some email clients are pretty picky when it comes to html emails (especially with all the doctype stuff)
#3

[eluser]litzinger[/eluser]
Yes, my Entourage is set to allow HTML emails. I just got an HTML newsletter a minute ago. If I use the mail() function and set the headers to send as HTML it works too. I tried sending the email without all that doctype stuff and it still didn't work. :/
#4

[eluser]sophistry[/eluser]
there is no such thing as an "Entourage Account". Perhaps you mean Entourage Client? What email ISP are you using? There is an outstanding bug in 1.5.3 that affects yahoo.com email accounts, maybe your ISP has the same issue. Search forums for yahoo and email. Or look in the bug tracker where i posted this bug.
#5

[eluser]litzinger[/eluser]
I used the term Entourage Account loosely. It's obviously the client I'm using with my work email.

I'm actually using 1.5.2.
#6

[eluser]sophistry[/eluser]
ok, i did in fact realize that you were referring to entourage the email client, but you still haven't mentioned what ISP you are using... my point was that you were comparing apples and oranges (gmail and entourage). it sounds like it might be an exchange server?

the bug is in 1.5.2 also i assume. it affects HTML emails sent to yahoo - they are blank when they arrive :-0
#7

[eluser]litzinger[/eluser]
Yes, it's an exchange server. I made the changes in the core noted on this page (http://ellislab.com/forums/viewthread/47129/P0/) but it still isn't working. I pasted a bit of the header of the email from my inbox. It's coming throug as multipart/alternative??

Code:
Content-Type: multipart/alternative; boundary="B_ALT_4682b8d75618e"
X-OriginalArrivalTime: 27 Jun 2007 19:21:59.0167 (UTC) FILETIME=[6EAA60F0:01C7B8F0]

This is a multi-part message in MIME format.
Your email application may not support this format.
--B_ALT_4682b8d75618e
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
vbcvbcxvbxcvb
--B_ALT_4682b8d75618e
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

&lt;html&gt;&lt;body&gt;<p>vbcvbcxvbxcvb</p>&lt;/body&gt;&lt;/html&gt;
#8

[eluser]sophistry[/eluser]
multipart alternative tells the email client program to try each part in turn and render the last one that it can. so, that is why plain is first and HTML is second - you want the HTML to take precedence.

have you tried a different charset than UTF-8?
#9

[eluser]litzinger[/eluser]
So how do I get HTML to take precedence? I'm already using

Code:
$config['mailtype'] = 'html';
$config['charset'] = 'UTF-8';
$this->email->initialize($config);
#10

[eluser]sophistry[/eluser]
yes, HTML takes precedence whenever you make an HTML email. you don't tell it to take precedence - it just does based on where it is in the email part order: last. if you want plain text email to take precedence just send a plain text email.

what i said was have you tried any other charsets? sometimes charsets can really change how things behave and transfer. maybe exchange needs some different charset?

the manual lists two: Character set (utf-8, iso-8859-1, etc.).

but, there are others, google for charset.




Theme © iAndrew 2016 - Forum software by © MyBB