Страница 1 из 1

Не отправляет Html документ функция mail

Добавлено: 2012-10-03 12:31:59
bobot
вот скрипт

Код: Выделить всё

$to='bobotol@domain';
$subject = '=?koi8-u?B?'.base64_encode('привет всем').'?=';


$header="Content-type: text/plain; charset=\"koi8-u\"";


$header.="From: admin <admin@domain>";
$header.="Subject: $subject";

$header.="Content-type: text/plain; charset=\"koi8-u\"";

$msg='
<html>
<head>
 <title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
 <tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
 </tr>
 <tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
 </tr>
 <tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
 </tr>
</table>
</body>
</html>
';
mail( $to,  $subject, $msg, $header);

и письмо приходит с текстом
  • <html>
    <head>
    <title>Birthday Reminders for August</title>
    </head>
    <body>
    <p>Here are the birthdays upcoming in August!</p>
    <table>
    <tr>
    <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
    </tr>
    <tr>
    <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
    </tr>
    <tr>
    <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
    </tr>
    </table>
    </body>
    </html>
т.е. как бы оно не понимает что я html документ впихнул ?

Re: Не отправляет Html документ функция mail

Добавлено: 2012-10-03 13:36:43
rayder
ну вы как-юы сами сказали ему, что отправляете в text/plain.

Код: Выделить всё

$header.="Content-type: text/plain; charset=\"koi8-u\"";
читайте, сравнивайте:

Код: Выделить всё

<?php
$to='mailtp';
$subject = '=?koi8-u?B?'.base64_encode('привет всем').'?=';
$header = "Content-type: text/html; charset=windows-1251;\n";
$header .= "From: admin <mailfrom>";
$header.="Subject: $subject";

$msg='
<html>
<head>
 <title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
 <tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
 </tr>
 <tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
 </tr>
 <tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
 </tr>
</table>
</body>
</html>
';
mail( $to,  $subject, $msg, $header);
?>