próbowałem za pomocą funkcji mail() dzieląc wiadomość na 2 części, jednakże wiadomość do skrzynki docierała uszkodzona. Czy to wina serwera czy źle poskładanego kodu?
<?php
$imie = $_POST['imie'];
$adres = $_POST['adres'];
$poczta = $_POST['poczta'];
$telefon1 = $_POST['telefon1'];
$telefon2 = $_POST['telefon2'];
$mail = $_POST['mail'];
$_FILES['doc_file']['tmp_name'];
$filename = $_FILES['doc_file']['name'];
$filesize = $_FILES['doc_file']['size'];
$directory2 = '/file_uploads/';
$uploadFile = $directory2 . $filename;
$tekstowy = "/file_uploads/$filename";
$FileHandle = fopen($tekstowy, 'rb');
// treść wiadomości.
$MsgHTMLPart = '
<html>
<head>
<title>Wiadomość w formacie HTML wraz z załącznikiem</title>
</head>
<body>
<p>
<?php
print "
\n Adres: $adres
\n Kod pocztowy: $poczta
\n Telefon: $telefon1
\n Telefon: $telefon2
\n E-mail: $mail";
?>
</p>
</body>
</html>';
$Recipient = 'xxx@xx.pl';
$MsgSubject = 'formularz';
$MsgHeader = "From: $mailr\n";
$MsgHeader .= "MIME-Version: 1.0\n";
$MsgHeader .= "Content-type: multipart/mixed; boundary=\"
--NSD35F65YGsgrg3--\"";
// treść
$MsgBody = "
--NSD35F65YGsgrg3--
Content-type: text/html, charset=iso-8859-2
Content-Transfer-Encoding: 8bit\n";
$MsgBody .= $MsgHTMLPart;
// załącznik
$MsgBody .= "
--NSD35F65YGsgrg3--
Content-type: application/octet-stream, name=\"" . $filename . "\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=\"" . $filename
. "\"\n\n";
$Msgbody .= $AttachmentData;
// Koniec wiadomości.
$MsgBody .= "\n--NSD35F65YGsgrg3--\n";
// Wysyłanie wiadomości.
mail($Recipient, $MsgSubject, $MsgBody, $MsgHeader); ?>