Mailinglisten-Archive |
das skript hat zwar mehrere anhänge, allerdings lässt sich immer nur der erste öffnen. der fehler liegt also wahrsch in der foreach schleife und dem aufbau durch boundary und \n. kennt jmd spontan die richtige kombination?! $boundary = md5(uniqid(time())); $header = "To: " . $to; $header = "From: " . $from . "\n"; $header .= "Cc: " . $cc . "\n";; $header .= "Bcc: " . $bcc; $header .= "\n"; $header .= "MIME-Version: 1.0"; $header .= "\n"; $header .= "Content-Type: multipart/mixed; boundary=$boundary"; $header .= "\n\n"; $header .= "This is a multi-part message in MIME format"; $header .= "\n"; $header .= "--$boundary"; $header .= "\n"; $header .= "Content-Type: text/plain"; $header .= "\n"; $header .= "Content-Transfer-Encoding: 8bit"; $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 $attachment_fread .= fread(fopen($attachment['tmp_name'], "r"), filesize($attachment['tmp_name'])); $header .= chunk_split(base64_encode($attachment_fread)); } // ($attachment['tmp_name'] != "none" && !empty($attachment['tmp_name'])) } // foreach } // is_array($attachments) $header .= "\n"; $header .= "--$boundary--"; $mail = mail($to, $subject, "", $header);
php::bar PHP Wiki - Listenarchive