{"id":22656858,"url":"https://github.com/libreworks/swiftmailer-spools","last_synced_at":"2025-04-12T04:53:58.584Z","repository":{"id":57014704,"uuid":"45208566","full_name":"libreworks/swiftmailer-spools","owner":"libreworks","description":"Additional spools for use with the SwiftMailer library.","archived":false,"fork":false,"pushed_at":"2019-06-27T13:56:48.000Z","size":20,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T04:53:49.375Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libreworks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-29T20:25:40.000Z","updated_at":"2019-09-25T11:40:56.000Z","dependencies_parsed_at":"2022-08-22T09:30:18.589Z","dependency_job_id":null,"html_url":"https://github.com/libreworks/swiftmailer-spools","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libreworks%2Fswiftmailer-spools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libreworks%2Fswiftmailer-spools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libreworks%2Fswiftmailer-spools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libreworks%2Fswiftmailer-spools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libreworks","download_url":"https://codeload.github.com/libreworks/swiftmailer-spools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248519472,"owners_count":21117757,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-09T10:16:42.799Z","updated_at":"2025-04-12T04:53:58.561Z","avatar_url":"https://github.com/libreworks.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swiftmailer-spools\nAdditional spools for use with the SwiftMailer library.\n\nThis includes spools for PDO and MongoDB.\n\n[![Packagist](https://img.shields.io/packagist/v/libreworks/swiftmailer-spools.svg)](https://packagist.org/packages/libreworks/swiftmailer-spools)\n[![Build Status](https://travis-ci.org/libreworks/swiftmailer-spools.svg)](https://travis-ci.org/libreworks/swiftmailer-spools)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/libreworks/swiftmailer-spools/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/libreworks/swiftmailer-spools/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/libreworks/swiftmailer-spools/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/libreworks/swiftmailer-spools/?branch=master)\n\n## Installation\n\nYou can install this library using Composer:\n\n```console\n$ composer require libreworks/swiftmailer-spools\n```\n\n* The master branch (version 2.x) of this project depends on SwiftMailer 6.0+, which requires PHP 7.0.\n* Version 1.x of this project depends on SwiftMailer 5.4+, which requires PHP 5.3. It also runs just fine on HHVM.\n\n## Compliance\n\nReleases of this library will conform to [Semantic Versioning](http://semver.org).\n\nOur code is intended to comply with [PSR-1](http://www.php-fig.org/psr/psr-1/) and [PSR-2](http://www.php-fig.org/psr/psr-2/). If you find any issues related to standards compliance, please send a pull request!\n\n## Examples\n\nHere's how to instantiate a `Swift_Mailer` object that uses the spools to send.\n\n```php\n$mailer = \\Swift_Mailer::newInstance(\n    \\Swift_SpoolTransport::newInstance(\n        $spool // your spool goes here\n    )\n);\n// this e-mail will get spooled\n$mailer-\u003esend(new \\Swift_Message($subject, $body, $contentType, $charset));\n```\n\nHere's how to instantiate a `Swift_Transport` to send spooled e-mails.\n\n```php\n$transport = \\Swift_SmtpTransport::newInstance($smtpHost, $smtpPort, $smtpEncrypt)\n    -\u003esetUsername($smtpUsername)\n    -\u003esetPassword($smtpPassword);\n\n$spool-\u003erecover();\n$spool-\u003eflushQueue($transport);\n```\n\n### PDO Spool\n\n```php\n$pdo = new \\PDO(\"mysql:dbname=testdb;host=127.0.0.1\", 'user', 'pass');\n$spool = new \\Swift_PdoSpool(\n    $pdo,\n    \"email\", // table\n    \"id\", // primary key field\n    \"message\", // serialized email field\n    \"sentOn\", // sent integer timestamp\n);\n```\n\n### MongoDB Spool\n\n```php\n$manager = new \\MongoDB\\Driver\\Manager(\"mongodb://localhost:27017\");\n$rp = new \\MongoDB\\Driver\\ReadPreference(\\MongoDB\\Driver\\ReadPreference::RP_PRIMARY_PREFERRED);\n$wr = new \\MongoDB\\Driver\\WriteConcern(\\MongoDB\\Driver\\WriteConcern::MAJORITY);\n$spool = new \\Swift_MongoDbSpool(\n    $manager,\n    \"dbname.emails\",\n    $rp, // optional\n    $wc, // optional\n);\n```\n\n### Mongo Spool (deprecated in 1.x; removed in 2.x)\n\n```php\n$client = new \\MongoClient();\n$db = new \\MongoDB(\"dbname\", $client);\n$collection = new \\MongoCollection($db, \"emails\");\n$spool = new \\Swift_MongoSpool($collection);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibreworks%2Fswiftmailer-spools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibreworks%2Fswiftmailer-spools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibreworks%2Fswiftmailer-spools/lists"}