Hallo
Folgendes Script versendet eine E-Mail mit Attachment.
Was mir einfach nicht gelingen will: wie versendet man zwei Attachments? Welcher Teil des Scripts muss wiederholt werden?
Wer hat einen Tipp?
Gruss
Borsi
$from = $\_POST['from']; $subject = $\_POST['subject']; $message = $\_POST['message']; $fileatt = $\_FILES['fileatt']['tmp\_name']; $fileatt\_type = $\_FILES['fileatt']['type']; $fileatt\_name = $\_FILES['fileatt']['name']; $headers = "From: $from"; if (is\_uploaded\_file($fileatt)) { $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $semi\_rand = md5(time()); $mime\_boundary = "==Multipart\_Boundary\_x{$semi\_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime\_boundary}\""; $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime\_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; $data = chunk\_split(base64\_encode($data)); $message .= "--{$mime\_boundary}\n" . "Content-Type: {$fileatt\_type};\n" . " name=\"{$fileatt\_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt\_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime\_boundary}--\n"; } $ok = @mail($to, $subject, $message, $headers); if ($ok) { echo " Mail sent! Yay PHP!"; } else { echo " Mail could not be sent. Sorry! "; } ?\>