Using Swift Mailer plugins with Laravel 4

The default mail system for Laravel 4 is Swift Mailer. Laravel 4 provides a neat wrapper for Swift Mailer which utilizes Laravels native views etc for templating html emails. To use Swift Mailer plugins with the native Mail implementation all you need to do is this:

// register the Redirecting Plugin in this case
Mail::getSwiftMailer()->registerPlugin(new \Swift_Plugins_RedirectingPLugin(''));

// no change to the rest of your code
Mail::send('emails.welcome', $data, function($message)
    $message->to('', 'John Smith')->subject('Welcome!');

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>