witam, mam kod który ma wysyłać email z powiadomieniem, ale nie mogę sobie z nim poradzić cały czas skrypt wysyła mi w wiadomości warunki Content-Type w wew. wiadomości i ich nie interpretuje nie rozróżnia co jest text/plain a co text/html, załącznik wyświetlany jest w postaci binarnej, napewno coś robię źle tylko nie wiem co, proszę o pomoc oto kod:
<?php
$to = 'mymail@gmail.com';
$subject = 'Test.';
$headers = "From: Faktury \r\n Reply-To: księgowosc@domena.pl"."\r\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\""."\r\n";
$headers .= "MIME-Version: 1.0"."\r\n";
?>
--PHP-mixed-
<?php echo $random_hash; ?>Content-Type: multipart/alternative; boundary="PHP-alt-
<?php echo $random_hash; ?>"
--PHP-alt-
<?php echo $random_hash; ?>Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hello World!!!
This is simple text email message.
--PHP-alt-
<?php echo $random_hash; ?>Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
<h2>Hello World!</h2>
<p>This is something with <b>HTML</b> formatting.</p>
--PHP-alt-
<?php echo $random_hash; ?>--
--PHP-mixed-
<?php echo $random_hash; ?>Content-Type: image/jpg; name="logo_notemaster.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="logo_notemaster.jpg"
<?php echo $attachment; ?> --PHP-mixed-
<?php echo $random_hash; ?>--
<?php
$mail_sent = @mail( $to, $subject, $message, $headers );
echo $mail_sent ?
"Mail sent" : "Mail failed"; ?>