2017 © Pedro Peláez
 

library swiftmailer-spools

Additional spools for use with the SwiftMailer library

image

libreworks/swiftmailer-spools

Additional spools for use with the SwiftMailer library

  • Sunday, February 11, 2018
  • by doublecompile
  • Repository
  • 1 Watchers
  • 2 Stars
  • 405 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 2 % Grown

The README.md

swiftmailer-spools

Additional spools for use with the SwiftMailer library., (*1)

This includes spools for PDO and MongoDB., (*2)

Packagist Build Status Scrutinizer Code Quality Code Coverage, (*3)

Installation

You can install this library using Composer:, (*4)

$ composer require libreworks/swiftmailer-spools
  • The master branch (version 2.x) of this project depends on SwiftMailer 6.0+, which requires PHP 7.0.
  • Version 1.x of this project depends on SwiftMailer 5.4+, which requires PHP 5.3. It also runs just fine on HHVM.

Compliance

Releases of this library will conform to Semantic Versioning., (*5)

Our code is intended to comply with PSR-1 and PSR-2. If you find any issues related to standards compliance, please send a pull request!, (*6)

Examples

Here's how to instantiate a Swift_Mailer object that uses the spools to send., (*7)

$mailer = \Swift_Mailer::newInstance(
    \Swift_SpoolTransport::newInstance(
        $spool // your spool goes here
    )
);
// this e-mail will get spooled
$mailer->send(new \Swift_Message($subject, $body, $contentType, $charset));

Here's how to instantiate a Swift_Transport to send spooled e-mails., (*8)

$transport = \Swift_SmtpTransport::newInstance($smtpHost, $smtpPort, $smtpEncrypt)
    ->setUsername($smtpUsername)
    ->setPassword($smtpPassword);

$spool->recover();
$spool->flushQueue($transport);

PDO Spool

$pdo = new \PDO("mysql:dbname=testdb;host=127.0.0.1", 'user', 'pass');
$spool = new \Swift_PdoSpool(
    $pdo,
    "email", // table
    "id", // primary key field
    "message", // serialized email field
    "sentOn", // sent integer timestamp
);

MongoDB Spool

$manager = new \MongoDB\Driver\Manager("mongodb://localhost:27017");
$rp = new \MongoDB\Driver\ReadPreference(\MongoDB\Driver\ReadPreference::RP_PRIMARY_PREFERRED);
$wr = new \MongoDB\Driver\WriteConcern(\MongoDB\Driver\WriteConcern::MAJORITY);
$spool = new \Swift_MongoDbSpool(
    $manager,
    "dbname.emails",
    $rp, // optional
    $wc, // optional
);

Mongo Spool (deprecated in 1.x; removed in 2.x)

$client = new \MongoClient();
$db = new \MongoDB("dbname", $client);
$collection = new \MongoCollection($db, "emails");
$spool = new \Swift_MongoSpool($collection);

The Versions

11/02 2018

dev-master

9999999-dev http://github.com/libreworks/swiftmailer-spools

Additional spools for use with the SwiftMailer library

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb database mail email mailer pdo

11/02 2018

2.0.0

2.0.0.0 http://github.com/libreworks/swiftmailer-spools

Additional spools for use with the SwiftMailer library

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb database mail email mailer pdo

19/09 2016

1.0.x-dev

1.0.9999999.9999999-dev http://github.com/libreworks/swiftmailer-spools

Additional spools for use with the SwiftMailer library

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb database mail email mailer pdo

27/02 2016

1.0.1

1.0.1.0 http://github.com/libreworks/swiftmailer-spools

Additional spools for use with the SwiftMailer library

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb database mail email mailer pdo

11/02 2016

1.0.0

1.0.0.0 http://github.com/libreworks/swiftmailer-spools

Additional spools for use with the SwiftMailer library

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb database mail email mailer pdo