PEAR Mail Mime

From Triangle Wiki

Jump to: navigation, search

Sending mixed-type messages with PEAR::Mail Mime

<?php
require_once 'Mail.php';
require_once 'Mail\mime.php';
 
$message = new Mail_mime();
 
$text = 'Hello this is the Plain email';
$html = '<b>Hello</b><hr />This is the HTML email.';
 
$message->setTXTBody($text);
$message->setHTMLBody($html);
 
$body = $message->get();
 
$extraheaders = array('From' => 'me@example.com',
  'Subject' => 'Subject');
 
$headers = $message->headers($extraheaders);
$mail    = Mail::factory('mail');
$mail->send('best@example.com', $headers, $body);
?>

External Links

Navigation

[Edit Navigation]

Personal tools