Basic Usage

Jadu's service container has a getMail method which provides you with an instance of Jadu_Service_Mail. This does the heavy lifting for you if your application is configured correctly.

$mail = Jadu_Service_Container::getInstance()->getMail();

Mail container (basic)

The send method within the Jadu_Service_Mail class expects an instance of Jadu_Container_Mail which allows holds all of the necassary data

$data = new Jadu_Container_Mail(
    'from-email@jadu.net',
    'to-email@jadu.net',
    'Hello World!',
    'Welcome to Jadu.net'
);

HTML emails

$data->setType('text/html');

Adding an attachment

$data->addAttachment('/path/to/file.ext', 'file-name.ext');

Or add multiple attachments passing an array

$data->addAttachments(array(
    '/path/to/first/file.ext' => 'file-name-1.ext',
    '/path/to/second/file.ext' => 'file-name-2.ext',
));

Carbon Copy (CC)

$data->addCc($email, $name);

Blind Carbon Copy (BCC)

$data->addBcc($email, $name);

Reply-To

$data->addReplyTo($email, $name);

Sending the email

$mail->send($data);

results matching ""

    No results matching ""