Mailinglisten-Archive |
Kannst Du mir den Quellcode als Attachement schicken?
Danke und
Grüße
>From: "Nils Meyer" <meyer_(at)_wmc24.de>
>Reply-To: php_(at)_phpcenter.de
>To: <php_(at)_phpcenter.de>
>Subject: Re: [php] Anhaenge an Mails?
>Date: Wed, 23 May 2001 16:11:29 +0200
>
> > gibt es eine Möglichkeit,unter PHP, Anhänge an Mails anzufügen ?
> > Weder mit mail(), noch mit imap_mail() bin ich bisher zum Erfolg
>gelangt.
> > Hab' ich irgendwas übersehen oder geht's einfach nicht ?
>Die Möglichkeit besteht auf jeden Fall, da du die Header alle selber
>verändern kannst. Ich habe dazu folgende Funktion im Einsatz:
>
>function mailfile($datei,$reciever,$mail_content,$subject,$from) {
> /* Lese die temporaere Datei, die der Benutzer
>hochgeladen hat aus */
> $datei_content =
>fread(fopen($datei,"r"),filesize($datei));
>
> /* Codiere Datei ins BASE64-Format, falls
>noetig */
> $datei_content =
>chunk_split(base64_encode($datei_content));
>
> /* Generiere einen Boundary */
> $boundary = strtoupper(md5(uniqid(time())));
> $mail_header="FROM: $from";
> /* Beginne den Mail-Header mit
>MIME-Mail-Header */
> $mail_header .= "\nMIME-Version: 1.0";
> $mail_header .= "\nContent-Type:
>multipart/mixed; boundary=$boundary";
> $mail_header .= "\n\nThis is a multi-part
>message in MIME format -- Dies ist eine mehrteilige Nachricht im
>MIME-Format";
>
> /* Hier faengt der normale Mail-Text an */
> $mail_header .= "\n--$boundary";
> $mail_header .= "\nContent-Type:
>$content_type";
> $mail_header .= "\nContent-Transfer-Encoding:
>8bit";
> $mail_header .= "\n\n$mail_content";
>
> /* Hier faengt der Datei-Anhang an */
> $mail_header .= "\n--$boundary";
> $mail_header .= "\nContent-Type:
>application/x-zip-compressed; name=\"$datei\"";
> /* Lese aus dem Array $contenttypes die
>Codierung fuer den MIME-Typ des Anhangs aus */
> $mail_header .= "\nContent-Transfer-Encoding:
>base64";
> $mail_header .= "\nContent-Disposition:
>attachment; filename=\"$dateiname\"";
> $mail_header .= "\n\n$datei_content";
>
> /* Gibt das Ende der eMail aus */
> $mail_header .= "\n--$boundary--";
>
>
> /* Sende eMail und gebe Fehler bzw. Bestaetigung aus
>*/
> mail($reciever,$subject,"",$mail_header);
> }
>
>kann sien das die darstellung durch den Umbruch etwas chaotisch ist,
>ich kann dir die funktion notfalls nochmal per PM als attachment
>schicken.
>
>
>mit freundlichen Grüßen
>Nils Meyer
>
>--
>Eichenweg 7, 21745 Hemmoor
>phoneto: +49 (0)4771-689880 | mobilephoneto: +49(0)174 20 34 08 5
>faxto: +49 (0) 89-55 29 83-5590
>mailto:meyer_(at)_wmc24.de | http://www.webmasterchannel.de
>
>
>--
>** http://www.php-center.de **
>Die PHP-Liste: mailto: php_(at)_phpcenter.de
>http://lists.phpcenter.de/mailman/listinfo/php
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
php::bar PHP Wiki - Listenarchive