MailerQ Transport Plugin for Swift Mailer

If you use Swift Mailer as your main mail engine in your project you can download MailerQ Transport Plugin to extend functionality of the Swift Mailer. Below you can find an example showing how to combine those two projects together.


// load required dependencies
require_once 'swiftmailer/lib/swift_required.php';
require_once 'MailerQPlugin/MailerQConnection.php';
require_once 'MailerQPlugin/MailerQTransport.php';

// an array with additional options
$options = array(
'ips'           =>  ['',''],
'maxattempts'   =>  5

// set up a connection to AMQP server
$connection = new MailerQConnection('localhost', 'outbox', 'guest', 'guest', '/');

// create the message using Swift_Message
$message = Swift_Message::newInstance();
$message->setSubject('This email was sent using Swift MailerQ Transport Plugin');
$message->setBody('Example message');
$message->setFrom('', 'Example');

// deliver the message to

// create a new MailerQTransport instance
$transport = new MailerQTransport($connection, $options);

// create a new SwiftMailer instance
$mailer = Swift_Mailer::newInstance($transport);

// send the actual message using the MailerQTransporter