Помогите, пожалуйста.
Навоял скрипт. корявый, не буду спорить, но все рабоатет.
Кроме одного: $htmlbody - это приложенный файл в виде html -
в нем на экране не выводятся приаттаченную каринку
Может я в html неправильно прописываю картинку? ПОдскажите
Проблема в том, что хочу что бы он отражался в письме как обычный html
$htmlbody="
xxxxDDDDDDDDD Ya TUUT!123";
//$htmlbody - текст в html виде
//$body - текст (тело письма)
//$attachmentfileNAME - имя файла (картинка);
//$attachmentPATH - имя файла и полный путь к нему;
$attachment1=$attachmentPATH ;
If ($attachmentPATH<>""){
//photo
$fp = fopen($attachment1, "r");
$read = fread($fp, filesize($attachment1));
$read = base64_encode($read);
$read = chunk_split($read);
fclose($fp);
}
//$headers = "Content-Transfer-Encoding: 8bit\\r\\n";
$headers .= "Content-Type: multipart/mixed; boundary=\\"XX-1234DED00099A\\"\\r\\n";
$headers .= "MIME-Version: 1.0\\r\\n";
$headers .= "From: <$emailto>\\r\\n";
///// HTML //////
$headers .= "\\r\\n";
$headers .= "--XX-1234DED00099A\\r\\n";
//$headers .= "Content-Disposition: inline; filename=\\"mail.txt\\"\\r\\n";
//$headers .= "Content-Transfer-Encoding: 8bit\\r\\n";
$headers .= "Content-type: text/html;\\r\\n";
$headers .= "\\r\\n".$htmlbody."\\r\\n";
////// HTML /////
$headers .= "\\r\\n";
$headers .= "--XX-1234DED00099A\\r\\n";
//$headers .= "Content-Disposition: inline; filename=\\"mail.txt\\"\\r\\n";
$headers .= "Content-Transfer-Encoding: 8bit\\r\\n";
$headers .= "Content-type: text/plain; charset=koi8-r\\r\\n";
$headers .= "\\r\\n".$body."\\r\\n";
If ($attachmentPATH<>""){
$headers .= "--XX-1234DED00099A\\r\\n";
$headers .= "Content-type: application/octet-stream; name=\\"$attachmentfileNAME\\"\\r\\n";
//можно и так $headers .= "Content-type: application/octet-stream; \\r\\n";
$headers .= "Content-Disposition: attachment; filename=\\"$attachmentfileNAME\\"\\r\\n";
$headers .= "Content-Transfer-Encoding: base64\\r\\n";
$headers .= "\\r\\n".$read."\\r\\n";
$headers .= "--XX-1234DED00099A--\\r\\n";
}
?>
if ( mail($emailto,$subject,$body, $headers)) {
echo " Has been sent to: $emailto";
} else {
echo "Увы, ошибка :о(";
}
?>