W
Cool, danke ihr beiden! Ihr hattet beide recht, ich muss \r\n durch \n ersetzen und im Header, wo boundary definiert wird, muss dahinter noch ein Semikolon. Danke ihr beiden! Zur Komplettlösung gebe ich nochmal die xmail()-Funktion durch:
function xmail($email_address,$email_cc,$email_bcc,$email_from,$subject,$msg,$attach_filepath,$want_attach) {
$b = 0;
$mail_attached = "";
$boundary = "000XMAIL000";
if (count($attach_filepath)>0 && $want_attach) {
for ($a=0;$a<count($attach_filepath);$a++) {
if ($fp=fopen($attach_filepath[$a],"rb")) {
$file_name=basename($attach_filepath[$a]);
$content[$b]=fread($fp,filesize($attach_filepath[$a]));
$mail_attached.="--".$boundary."\n"
."Content-Type: image/jpeg; name=\"$file_name\"\n"
."Content-Transfer-Encoding: base64\n"
."Content-Disposition: inline; filename=\"$file_name\"\n\n"
.chunk_split(base64_encode($content[$b]))."\n";
$b++;
fclose($fp);
} else {
echo "Anhang konnte nicht gesendet werden.";
}
}
$mail_attached .= "--".$boundary."\n";
$add_header ="MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"$boundary\";
Message-ID: <".md5($email_from)."@domain.net>";
$mail_content="--".$boundary."\n"
."Content-Type: text/plain; charset=\"iso-8859-1\"\n"
."Content-Transfer-Encoding: 8bit\n\n"
.$msg."\n\n".$mail_attached;
return mail($email_address,$subject,$mail_content,"From: ".$email_from."\nCC: ".$email_cc."\nBCC: ".$email_bcc."\nErrors-To: ".$email_from."\n".$add_header);
} else {
return mail($email_address,$subject,$msg,"From: ".$email_from."\nCC: ".$email_cc."\nBCC: ".$email_bcc."\nErrors-To: ".$email_from);
}
}