{"id":21633922,"url":"https://github.com/tweedegolf/swiftmailer-logger-bundle","last_synced_at":"2025-04-11T15:29:03.014Z","repository":{"id":19584919,"uuid":"22834985","full_name":"tweedegolf/swiftmailer-logger-bundle","owner":"tweedegolf","description":"Log emails sent with Swift Mailer in your Symfony2 project","archived":false,"fork":false,"pushed_at":"2021-12-13T06:46:35.000Z","size":47,"stargazers_count":10,"open_issues_count":2,"forks_count":7,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-25T11:39:07.791Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/tweedegolf.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":"2014-08-11T10:12:10.000Z","updated_at":"2022-10-31T18:04:08.000Z","dependencies_parsed_at":"2022-07-23T13:00:06.679Z","dependency_job_id":null,"html_url":"https://github.com/tweedegolf/swiftmailer-logger-bundle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tweedegolf%2Fswiftmailer-logger-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tweedegolf%2Fswiftmailer-logger-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tweedegolf%2Fswiftmailer-logger-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tweedegolf%2Fswiftmailer-logger-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tweedegolf","download_url":"https://codeload.github.com/tweedegolf/swiftmailer-logger-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248430759,"owners_count":21102077,"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-11-25T03:14:30.736Z","updated_at":"2025-04-11T15:29:02.985Z","avatar_url":"https://github.com/tweedegolf.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftmailerLoggerBundle\n\nThe tweedegolf SwiftmailerLoggerBundle provides an easy way to log messages sent with Swift Mailer. Currently\nthe bundle only provides an 'entity logger', which uses its `LoggedMessage` Doctrine entity to store\nthe details of a message that was sent. In the near future, a file logger will be added. Please note that the bundle is a work in progress and pay attention to the issue that was reported on 10-9-2014 about using lifecycle events.\n\n## Installation and configuration\n\nUsing [Composer][composer], please run the following command to add the bundle to your composer.json and to install it\nimmediately:\n\n```\ncomposer require tweedegolf/swiftmailer-logger-bundle:dev-master\n```\n\n### Basic configuration\nAdd the following configuration to your configuration file `app/config/config.yml`:\n\n```\ntweede_golf_swiftmailer_logger:\n    loggers:\n        entity_logger:\n            enabled: true\n        symfony_logger:\n            enabled: true\n```\n\nThis will enable the only logger that is currently available: the entity logger.\n\n### Add the bundle to your AppKernel\nAdd the bundle in `app/AppKernel.php`, as shown below:\n\n```php\npublic function registerBundles()\n{\n    return array(\n        // ...\n        new Knp\\Bundle\\PaginatorBundle\\KnpPaginatorBundle(),\n        new TweedeGolf\\SwiftmailerLoggerBundle\\TweedeGolfSwiftmailerLoggerBundle(),\n        // ...\n    );\n}\n```\n\n### Update your database schema\nFinally, update your database schema such that `LoggedMessage` entities can be stored by Doctrine.\n\n## Usage\nWith the above all set up, logging is automatic. The bundle provides a listener that listens to the\n`Swift_Events_SendEvent sendPerformed` event on which it passes on the data to be logged to any loggers configured.\n\n\n### What is being logged?\nEvery time an email is sent in your app with Swiftmailer, an LoggedMessage record is written to the database. This record contains the following info\n- the from, to, replyTo, cc and bcc address fields, all stored as array type\n- the return path (string)\n- the subject of the message\n- the body of the message\n- the date and time that the message was sent\n- the sending result\n- any failed recipients\n\nOf these, the sending result and failed recipients require some explanation. The sending result always contains one of the following strings \"pending\", \"success\", \"tentative\", \"failed\" or \"unknown\"\nrepresenting the results (except for \"spooled\") that a Swift_Events_SendEvent can have. In the failed recipients field recipients are logged for which a\nSwift_RfcComplianceException or Swift_TransportException was thrown during sending. Note that a \"success\" result and no failed recipients *does not mean* that all recipients actually received the\nemail that was logged: we only no that there were no problems during sending.\n\n### Retrieving logged messages\nThe bundle provides an empty `LoggedMessage` repository that can be used to retrieve messages logged by the entity logger.\nRetrieve it for example in one of your controllers by using:\n\n```\n$repo = $this-\u003egetDoctrine()-\u003egetRepository(\"TweedeGolfSwiftmailerLoggerBundle:LoggedMessage\");\n\n```\n\n### Use multiple or custom instances of Swift mailer\nIf you are using multiple Swift instances on your application or if you have overwritten the name of your Swift instance, modify your `app/config.yml` as shown below:\n```\ntweede_golf_swiftmailer_logger:\n   swift_instances:\n        - default\n        - secondary_smtp\n        \n    loggers:\n        entity_logger:\n            enabled: true\n```\n\nUsing multiple Swift instances, your Swiftmailer configuration will look something like this:\n\n```\nswiftmailer:\n    default_mailer: default\n    mailers:\n        default:\n            transport:  %swift_transport%\n            username: %swift_username%\n            password: %swift_password%\n\n        secondary_smtp:\n            transport:  %swift_transport2%\n            username: %swift_username2%\n            password: %swift_password2%\n\n```\n\n[composer]: https://getcomposer.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftweedegolf%2Fswiftmailer-logger-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftweedegolf%2Fswiftmailer-logger-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftweedegolf%2Fswiftmailer-logger-bundle/lists"}