PHPMailer bundle for Laravel 3
Switch branches/tags
Nothing to show
Latest commit e20b569 Jan 10, 2013
cviebrock Merge pull request #4 from rk/patch-1
Removed singleton restriction [#2]
Failed to load latest commit information.
config Better config handling Mar 14, 2012
lib first commit Mar 13, 2012
bundle.php first commit Mar 13, 2012 add to bundles.php for install Jun 27, 2012
start.php Removed singleton restriction [#2] Jan 10, 2013

PHPMailer Bundle, by Colin Viebrock

A Laravel PHPMailer bundle, installable via the Artisan CLI:

php artisan bundle:install phpmailer

Add it to application/bundles.php:

return array(
    'phpmailer' => array(
        'auto'  => true

To get a PHPMailer instance:

$mailer = IoC::resolve('phpmailer');

Then, use it just like you normally might:

try {
    $mailer->AddAddress( $user->email, $user->name );
    $mailer->Subject  = "Laravel Rocks";
    $mailer->Body     = "Hi! Laravel is awesomesauce!";
} catch (Exception $e) {
    echo 'Message was not sent.';
    echo 'Mailer error: ' . $e->getMessage();

The default "From:" address -- among other settings -- can be defined in the configuration file.

Includes PHPMailer - Full Featured Email Transfer Class for PHP