Gena
Posts: 591
|
| Posted: 01/22/2008, 2:52 PM |
|
I have strange problem sending HTML email. Customer who uses Outlook and some FireBird users can not get it, I mean it get it just like text email with HTML code inside - not like HTML normal email.
I'm using this function:
function sendNmail($FromAddress,$ToAddress,$Subject,$Message,$EmailType)
{
$date = date("r");
$Additional_Headers="From: $FromAddress\r\nReply-To: $FromAddress\r\nMIME-Version: 1.0\r\nContent-Type: text/";
$Additional_Headers.=(strcasecmp($EmailType,"html")==0)?"html":"plain";
$Additional_Headers.="; charset=utf-8\r\nContent-Transfer-Encoding: 8bit\r\nDate: " . $date . "\r\n";
$result = mail ($ToAddress, $Subject, $Message, $Additional_Headers);
return;
}
it generates right header but it not recognized by Outlook... Is there any solution?
_________________
Gena |
 |
 |
DonP
|
| Posted: 01/22/2008, 3:06 PM |
|
Apparently your dynamic code is somehow losing the proper Content-Type
and is sending only Content-Type:text. The Content-Type:text/html seems
to be getting lost. You can trying echoing to the screen what it thinks
it's sending.
Don (DonP)
Gena wrote:
> I have strange problem sending HTML email. Customer who uses Outlook and some
> FireBird users can not get it, I mean it get it just like text email with HTML
> code inside - not like HTML normal email.
>
> I'm using this function:
>
>
> function sendNmail($FromAddress,$ToAddress,$Subject,$Message,$EmailType)
> {
> $date = date("r");
> $Additional_Headers="From: $FromAddress\r\nReply-To:
> $FromAddress\r\nMIME-Version: 1.0\r\nContent-Type: text/";
> $Additional_Headers.=(strcasecmp($EmailType,"html")==0)?"html":"plain";
> $Additional_Headers.="; charset=utf-8\r\nContent-Transfer-Encoding:
> 8bit\r\nDate: " . $date . "\r\n";
> $result = mail ($ToAddress, $Subject, $Message, $Additional_Headers);
> return;
> }
>
>
> it generates right header but it not recognized by Outlook... Is there any
> solution?
> _________________
> Gena
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
Gena
Posts: 591
|
| Posted: 01/22/2008, 3:20 PM |
|
Quote DonP:
Apparently your dynamic code is somehow losing the proper Content-Type
and is sending only Content-Type:text. The Content-Type:text/html seems
to be getting lost. You can trying echoing to the screen what it thinks
it's sending.
No, if you look better to this code
$Additional_Headers.=(strcasecmp($EmailType,"html")==0)?"html":"plain";
then it does a job when I pass HTML as $EmailType.
BTW it generates email like:
To:a@aaa.com
Subject: subg bla bla bla
From:bbb@bbb.com
Reply-To:bbb@bbb.com
MIME-Version: 1.0
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit
Date: Mon, 21 Jan 2008 10:18:28 -1100
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
.... etc
_________________
Gena |
 |
 |
DonB
|
| Posted: 01/22/2008, 4:23 PM |
|
Outlook has a 'read all mail as text' option. Could it be that?
--
DonB
http://ccswiki.gotodon.net
"Gena" <Gena@forum.codecharge> wrote in message
news:547967a54b84c3@news.codecharge.com...
> Quote DonP:
> Apparently your dynamic code is somehow losing the proper Content-Type
> and is sending only Content-Type:text. The Content-Type:text/html seems
> to be getting lost. You can trying echoing to the screen what it thinks
> it's sending.
>
> No, if you look better to this code
>
> $Additional_Headers.=(strcasecmp($EmailType,"html")==0)?"html":"plain";
>
>
> then it does a job when I pass HTML as $EmailType.
>
> BTW it generates email like:
>
>
> To:a@aaa.com
> Subject: subg bla bla bla
> From:bbb@bbb.com
> Reply-To:bbb@bbb.com
> MIME-Version: 1.0
> Content-Type: text/html; charset=utf-8
> Content-Transfer-Encoding: 8bit
> Date: Mon, 21 Jan 2008 10:18:28 -1100
>
>
> <html>
> <head>
> <meta http-equiv="content-type" content="text/html; charset=utf-8">
>
>
> ... etc
>
> _________________
> Gena
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
DonP
|
| Posted: 01/22/2008, 4:25 PM |
|
If you're sure it's not the Content-Type, it could be your charset type
as I have not tried utf-8. I generally use iso-8859-1 which does indeed
send HTML mail properly. Otherwise maybe the mail client is set to read
all mail as text.
Don (DonP)
Gena wrote:
> I have strange problem sending HTML email. Customer who uses Outlook and some
> FireBird users can not get it, I mean it get it just like text email with HTML
> code inside - not like HTML normal email.
>
> I'm using this function:
>
>
> function sendNmail($FromAddress,$ToAddress,$Subject,$Message,$EmailType)
> {
> $date = date("r");
> $Additional_Headers="From: $FromAddress\r\nReply-To:
> $FromAddress\r\nMIME-Version: 1.0\r\nContent-Type: text/";
> $Additional_Headers.=(strcasecmp($EmailType,"html")==0)?"html":"plain";
> $Additional_Headers.="; charset=utf-8\r\nContent-Transfer-Encoding:
> 8bit\r\nDate: " . $date . "\r\n";
> $result = mail ($ToAddress, $Subject, $Message, $Additional_Headers);
> return;
> }
>
>
> it generates right header but it not recognized by Outlook... Is there any
> solution?
> _________________
> Gena
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
Gena
Posts: 591
|
| Posted: 01/22/2008, 4:44 PM |
|
Quote DonB:
Outlook has a 'read all mail as text' option. Could it be that?
Thanks, will check it.
_________________
Gena |
 |
 |
Gena
Posts: 591
|
| Posted: 01/22/2008, 4:51 PM |
|
Quote DonP:
If you're sure it's not the Content-Type, it could be your charset type
as I have not tried utf-8. I generally use iso-8859-1 which does indeed
send HTML mail properly. Otherwise maybe the mail client is set to read
all mail as text.
I don't know if that is the reason. All my customers gets the same email good formatted, but only one with Outlook doesn't...
_________________
Gena |
 |
 |
|