[php]mal z załąćznikami

0

czesc
sciagnalem sobie skrypt ktory wysyla pliki z zalacznikami,niby ok bo wysyla ale nie wysyla tekstu, jak zrobic zeby mogl wysylac tekst,a jak poprawic zebym mogl zalaczac zalaczniki ktore sa w mailu dokodu html maila np obrazki
pozdro

<?php

// Reading file content
$FilePathName = "konewka1.png"; // e.g. /tmp/myapp/file.gz
$FileName = "konewka1.png"; // just file.gz
$FileHandle = fopen($FilePathName, "rb");
$FileContent = fread($FileHandle, filesize($FilePathName));
fclose($FileHandle);
// Encode file content
$AttachmentData = chunk_split(base64_encode($FileContent));
// Message text
$MsgHTMLPart = "
<html>
<head>
  <title>HTML message with attachment</title>
</head>
<body>
  <h2>Congratulation!</h2>
  <p>You have just learned how to send a HTML message with attachment</p>
</body>
</html>
";
// Forming message
$Recepient = "[email protected]";
$MsgSubject = "Temat";
// You must set sender through message header
$MsgHeader = "From: staszek<[email protected]>\n";
// These two lines marks message as multipart
$MsgHeader .= "MIME-Version: 1.0\n";
$MsgHeader .= "Content-Type: multipart/mixed; boundary=\"—–NSD35F65YGsgrg3—–\"";
// First part begins
$MsgBody = "
——-NSD35F65YGsgrg3—–
Content-type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit\n";
$MsgBody .= $MsgHTMLPart;
// Second part begins
$MsgBody .= "
——-NSD35F65YGsgrg3—–
Content-Type: application/octet-stream; name=\"" . $FileName . "\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=\"" . $FileName . "\"\n\n";
$MsgBody .= $AttachmentData;
// Message ends
$MsgBody .= "\n—–NSD35F65YGsgrg3——-\n";
// Sending message
mail($Recepient, $MsgSubject, $MsgBody, $MsgHeader);
?>

i nie ma tego teksta w srodku;(

0

doszedłem do czegoś takiego

<?php

// Reading file content
$FilePathName = "lovetux.jpg"; // e.g. /tmp/myapp/file.gz
$FileName = "lovetux.jpg"; // just file.gz
$FileHandle = fopen($FilePathName, "rb");
$FileContent = fread($FileHandle, filesize($FilePathName));
fclose($FileHandle);
// Encode file content
$AttachmentData = chunk_split(base64_encode($FileContent));
// Message text
$MsgHTMLPart = "
<html>
<head>
  <title>HTML message with attachment</title>
</head>
<body>
  <h2>Congratulation!</h2>
  <p>You have just learned how to send a HTML message with attachment</p>
</body>
</html>
";
// Forming message
$Recepient = "[email protected]";
$MsgSubject = "Temat";
// You must set sender through message header
$MsgHeader = "From: abc<[email protected]>\n";
// These two lines marks message as multipart
$MsgHeader .= "MIME-Version: 1.0\n";
$MsgHeader .= "Content-Type: multipart/mixed; boundary=\"rozdzialka\"";
// First part begins
$MsgBody = "
--rozdzialka
Content-type: text/html; charset=\"utf-8\"
Content-Transfer-Encoding: 7bit\n";
$MsgBody .= $MsgHTMLPart;
// Second part begins
$MsgBody .= "
--rozdzialka
Content-Type: image/jpeg; name=\"".$FileName."\";
Content-Transfer-Encoding: base64
Content-Disposition: attachment ";
$MsgBody .= $AttachmentData;
// Message ends
$MsgBody .= "\n--rozdzialka\n";
// Sending message
mail($Recepient, $MsgSubject, $MsgBody, $MsgHeader);
?>

jest tylko jeden problem bo wysyła się załącznik ale on jest jakiś dziwny zajmuje tam odpowiednią ilośc ale nie da się go odtworzyc,jak to odkodowac? i jak zrobic zeby wystwietlic ten obraz w e-mailu?

1 użytkowników online, w tym zalogowanych: 0, gości: 1