1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| <?php
include('Mail.php');
include('Mail/mime.php');
$text = "Version texte de l'email";
$html = "<html><body>Version HTML de l'email</body></html>";
$file = 'test.pdf';
$crlf = "\r\n";
$hdrs = array(
'From' => 'test@test.ca',
'Subject' => 'Test message MIME'
);
$mime = new Mail_mime($crlf);
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addAttachment($file, 'application/pdf');
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail');
$mail->send('test@test.com', $hdrs, $body);
?> |