9.1. Introduction

Solar comes with classes to help you build email messages and send them using various transport mechanisms. Here's a very basic example:

 * first, compose a message

// build a message
$mail = Solar::factory('Solar_Mail_Message');

// from, to, and subject lines
     ->addTo('bolivar@example.net', 'Bolivar Shagnaasty')
     ->setSubject('An Example Email Message');

// add a "text" body component
$mail->setText("Hello world!");

// add an "html" body component
$mail->setHtml("<p><em>Hello</em> world!</p>");

// add an attachment
$file = '/path/to/image.jpg';
$mime = 'image/jpeg';
$mail->attachFile($file, $mime);

 * now send the message using php mail()

// build a transport
$transport = Solar::factory('Solar_Mail_Transport', array(
    'adapter' => 'Solar_Mail_Transport_Adapter_Phpmail',

// send the mail through the transport