Mailinglisten-Archive | 
Steffen Kother schrieb:
> Hi Leute,
> 
> ich habe Problem beim Versenden von Mails mit HTML-Inhalt via
> PEAR::Mail. Mails ohne Content-Type kommen korrekt an.
> 
> [...]
> 	
> $Boundary = '_'.md5(time());
> $InfoText = '<html><body>'."\r\n";
> $InfoText.= '</body></html>';
> $Content = ' This is a multipart message in MIME format'."\r\n";
> [...]
> $Content.= "\r\n\r\n--".$Boundary."--\r\n";
> 
> require_once('Mail.php');
> 
> $MyMail =& new Mail;
> $Factory = $MyMail->factory(...);
> $Send    = $Factory->send(..., $Content);
ja klar, PEAR::Mail übergeht das natürlich alles, zum Schutz vor 
Einschleusung, für sowas musst du die dafür vorgesehenen Funktionen verwenden.
> Ich stehe irgendwie im Regen. Die Anlage, die ganze Mail - alles kommt
> klar an. Werde mir mal noch eine Testmail stricken und den ganzen Kram
> Schritt für Schritt nochmal durchgehen.
> 
> Schon mal Danke für eure Tipps oder Hinweise.
also ich mach das so:
<?php
public function send($recipient, $headers, $text, $html = false, 
$attachments = array())
{
     require_once 'Mail.php';
     require_once 'Mail/mime.php';
     require_once 'Attachment.class.php';
     $crlf = "\n";
     $mime = new Mail_mime($crlf);
     if ($html) {
         $mime->setHTMLBody($html);
     }
     if ($text) {
         $mime->setTXTBody($text);
     }
     $attachments = Attachment::getAll($attachments);
     foreach ($attachments as $attachment) {
         $mime->addAttachment($attachment->getFilePath(), 
$attachment->getMimeType());
     }
     //do not ever try to call these lines in reverse order
     $body = $mime->get();
     $headers = $mime->headers($headers);
     $mail =& Mail::factory('mail');
     return $mail->send($recipient, $headers, $body);
}
    php::bar PHP Wiki - Listenarchive