Mail_Mime - Example

Mail_Mime - Example – génération et envoi d'un courrier MIME

Example

<?php
include('Mail.php');
include(
'Mail/mime.php');

$text 'Version texte du courriel';
$html '<html><body>Version HTML du courriel</body></html>';
$file '/home/jean/exemple.php';
$crlf "\n";
$hdrs = array(
              
'From'    => '[email protected]',
              
'Subject' => 'Test message MIME'
              
);

$mime = new Mail_mime($crlf);

$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addAttachment($file'text/plain');

$body $mime->get();
$hdrs $mime->headers($hdrs);

$mail =& Mail::factory('mail');
$mail->send('postmaster@localhost'$hdrs$body);
?>