Swift Mailer Laravel Bundle
The power of Swift Mailer with the beauty of Laravel.
Install using the Artian CLI:
php artisan bundle:install messages
then edit application/bundles.php to autoload messages:
<?php
return array(
'messages' => array(
'auto' => true
),
You can then set your configuration at config/config.php.
<?php
Config::set('messages::config.transports.smtp.host', 'smtp.gmail.com');
Config::set('messages::config.transports.smtp.port', 465);
Config::set('messages::config.transports.smtp.username', '[email protected]');
Config::set('messages::config.transports.smtp.password', 'password');
Config::set('messages::config.transports.smtp.encryption', 'ssl');
<?php
Message::to('[email protected]')
->from('[email protected]', 'Bob Marley')
->subject('Hello!')
->body('Well hello Someone, how is it going?')
->send();
<?php
$message = Message::to('[email protected]')
->from('[email protected]', 'Bob Marley')
->subject('Hello!')
->body('Well hello Someone, how is it going?')
->send();
if($message->was_sent())
{
echo 'Sweet it worked!';
}
// Or:
if(Message::was_sent())
{
echo 'Sweet it worked!';
}
<?php
$message = Message::to('[email protected]')
->from('[email protected]', 'Bob Marley')
->subject('Hello!')
->body('Well hello Someone, how is it going?')
->send();
if($message->was_sent('[email protected]'))
{
echo 'Sweet, Someone got the email!';
}
<?php
Message::to('[email protected]')
->from('[email protected]')
->subject('Hello!')
->body('Well hello Someone, how is it going?')
->attach('/path/to/file.txt')
->send();
<?php
Message::to('[email protected]')
->from('[email protected]')
->subject('Hello!')
->body('Well hello <b>Someone</b>, how is it going?')
->html(true)
->send();
<?php
Message::to(array('[email protected]', '[email protected]' => 'name'))
->cc('[email protected]')
->bcc(array('[email protected]' => 'Another name', '[email protected]'))
->subject('Hello Guys!')
->body('I really like spamming people!')
->send();
<?php
Message::to('[email protected]')
->from('[email protected]')
->reply('[email protected]')
->subject('Hello!')
->body('Well hello <b>Someone</b>, how is it going?')
->html(true)
->send();
Swift Mailer is a component based mailing solution for PHP 5. It is released under the LGPL license.
- Homepage: http://swiftmailer.org
- Documentation: http://swiftmailer.org/docs
- Mailing List: http://groups.google.com/group/swiftmailer
- Bugs: https://github.com/swiftmailer/swiftmailer/issues
- Repository: https://github.com/swiftmailer/swiftmailer
Swift Mailer is highly object-oriented by design and lends itself to use in complex web application with a great deal of flexibility.
For full details on usage, see the documentation.