Mailinglisten-Archive |
ich hab's geschafft. das problem entsteht beim fread() und chunk_split. anscheinend wir jeder weitere anhang nicht mehr richtig kodiert. deswegen habe ich eine extra funktion angelegt. so geht's: ... $header .= "\n\n"; $header .= "$message"; // multiple attachments if (is_array($attachments)) { foreach($attachments as $attachment) { if ($attachment['tmp_name'] != "none" && !empty($attachment['tmp_name'])) { $header .= "\n"; $header .= "--$boundary"; $header .= "\n"; $header .= "Content-Type: " . $attachment['type'] . "; name=\"" . $attachment['name'] . "\""; $header .= "\n"; $header .= "Content-Transfer-Encoding: base64"; $header .= "\n"; $header .= "Content-Disposition: attachment; filename=\"" . $attachment['name'] . "\""; $header .= "\n\n"; // read attachment $header .= attachment_fread($attachment['tmp_name']); } // ($attachment['tmp_name'] != "none" && !empty($attachment['tmp_name'])) } // foreach } // is_array($attachments) $header .= "\n"; $header .= "--$boundary--"; $mail = mail($to, $subject, "", $header); return $mail; } function attachment_fread($attachment) { $attachment_fread = fread(fopen($attachment, "r"), filesize($attachment)); $attachment_chunk_split = chunk_split(base64_encode($attachment_fread)); return $attachment_chunk_split; }
php::bar PHP Wiki - Listenarchive