hallo,
mit folgender Funktion will ich ein PDF Dokument als Attachement versenden, aber anstatt des Attachements erhalte ich immer text.
Hat jemand eine Idee was ich Falsch mache
ZB.:
boundary="<<<:5d9798ece92450e88bd3274747ef6850"
--<<<:5d9798ece92450e88bd3274747ef6850
Content-Disposition: attachment;
Content-Type: Application/pdf; name="versand.pdf"
Content-Transfer-Encoding: base64
JVBERi0xLjMKMyAwIG9iago8PC9UeXBlIC9QYWdlCi9QYXJlbnQgMSAwIFIKL1Jlc291cmNlcyAy
IDAgUgovQ29udGVudHMgNCAwIFI+PgplbmRvYmoKNCAwIG9iago8PC9GaWx0ZXIgL0ZsYXRl
IDAgUgovQ29udGVudHMgNCAwIFI+RGVj
b2RlIC9MZW5ndGggNDcyPj4Kc3RyZWFtCnicbZJNj9owEIbv/Io57qpi/G3HnEogq1Ja2tK0h9Ve
QnBo2mC2CWz5+TUBqrZGkRzJesaaZ+bl8HZAURn4NfgJiUIqgYZPKhQKeHI6TcJRaCi3QGYM
QnBo2mC2CWz5+TUBqrZGkRzJesaaZ+pjv4
usw...............
danke
function mail_att($email_to, $email_from, $email_bcc, $email_subject, $fileatt)
{
$mime_boundary = "<<<:" . md5(uniqid(mt_rand(), 1));
$data = chunk_split(base64_encode(implode("", file($fileatt))));
$header= "MIME-Version: 1.0\r\n";
$header.= "Content-Type: multipart/mixed;\r\n";
$header.= "From: ".$email_from."\r\n";
if($email_bcc!="")
{
$header.= "Bcc: ".$email_bcc."\r\n";
}
$text="boundary=\"".$mime_boundary."\"\r\n";
$text.= "--".$mime_boundary."\r\n";
$text.= "Content-Disposition: attachment;\r\n";
$text.= "Content-Type: Application/pdf; name=\"".$fileatt."\"\r\n";
$text.= "Content-Transfer-Encoding: base64\r\n\r\n";
$text.= $data."\r\n";
$text.= "--" . $mime_boundary . "\r\n";
if(mail($email_to, $email_subject, $text, $header))
{ print "OK attachement 3"; }
else
{ print "KO attachement"; }
}