{"id":20838003,"url":"https://github.com/fusonic/php-messenger-mailer-bundle","last_synced_at":"2025-05-08T20:34:53.746Z","repository":{"id":56982739,"uuid":"378858312","full_name":"fusonic/php-messenger-mailer-bundle","owner":"fusonic","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-16T12:25:54.000Z","size":66,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-08T04:57:03.975Z","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/fusonic.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-21T08:22:13.000Z","updated_at":"2024-09-16T12:25:57.000Z","dependencies_parsed_at":"2024-02-12T15:13:40.535Z","dependency_job_id":"a4331dc2-4258-49e4-9585-6a80a3b046bd","html_url":"https://github.com/fusonic/php-messenger-mailer-bundle","commit_stats":{"total_commits":14,"total_committers":3,"mean_commits":4.666666666666667,"dds":0.2142857142857143,"last_synced_commit":"6b7436aad4c790eb9624c50e0fe80f62a1676f57"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fusonic%2Fphp-messenger-mailer-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fusonic%2Fphp-messenger-mailer-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fusonic%2Fphp-messenger-mailer-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fusonic%2Fphp-messenger-mailer-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fusonic","download_url":"https://codeload.github.com/fusonic/php-messenger-mailer-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253146055,"owners_count":21861325,"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-18T01:09:09.569Z","updated_at":"2025-05-08T20:34:53.693Z","avatar_url":"https://github.com/fusonic.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# messenger-mailer-bundle\n\n[![License](https://img.shields.io/packagist/l/fusonic/messenger-mailer-bundle?color=blue)](https://github.com/fusonic/php-messenger-mailer-bundle/blob/master/LICENSE)\n[![Latest Version](https://img.shields.io/github/tag/fusonic/php-messenger-mailer-bundle.svg?color=blue)](https://github.com/fusonic/php-messenger-mailer-bundle/releases)\n[![Total Downloads](https://img.shields.io/packagist/dt/fusonic/messenger-mailer-bundle.svg?color=blue)](https://packagist.org/packages/fusonic/messenger-mailer-bundle)\n![php 8.2+](https://img.shields.io/badge/php-min%208.1-blue.svg)\n\n* [About](#about)\n* [Install](#install)\n* [Usage](#usage)\n* [Contributing](#contributing)\n\n## About\n\nYou might need to bundle if your project fulfills the following criteria:\n\n* You are using **Symfony Mailer** with **Symfony Messenger**.\n* Your message queue containing the Mailer messages is running asynchronously.\n* Your email contains **attachments**.\n\nThis bundle solves the following problems that can occur:\n\n* If you use `Symfony\\Component\\Mime\\Email::attach` the message will contain the entire file. Using blob data inside the message transport is not recommended\n  and can lead to problems.\n* If you use `Symfony\\Component\\Mime\\Email::attachFromPath`, the path might not exist at the moment of handling the message (depending on your implementation).\nAn example is when you are generating a temporary file (such as a PDF) and want to attach it to the e-mail. If this is a temporary file\nit might get deleted before the message is handled.\n\n## Install\n\nUse composer to install the bundle from packagist.\n\n```bash\ncomposer require fusonic/messenger-mailer-bundle\n```\n\nRequirements:\n\n- PHP 8.2+\n- Symfony 6.2+\n\nIn case Symfony did not add the bundle to the bundle configuration, add the following (by default located in `config/bundles.php`):\n\n```\n\u003c?php\n\nreturn [\n    // ...\n    Fusonic\\MessengerMailerBundle\\MessengerMailerBundle::class =\u003e ['all' =\u003e true],\n];\n```\n\n## Configuration (optional)\nThe only thing you are required to configure is the provided middleware on your message bus that\nhandles the `SendEmailMessage` event.\n\n```yaml\n# Your messenger configuration\nframework:\n    # ...\n    messenger:\n        # ...\n        buses:\n            default: # or your own bus that handled the SendEmailMessage event\n                - Fusonic\\MessengerMailerBundle\\Middleware\\AttachmentEmailMiddleware\n\n\n# Bundle default configuration\nmessenger_mailer:\n    # Use the included filesystem implementation or implement your own service\n    # by implementing the `Fusonic\\MessengerMailerBundle\\Contracts\\EmailAttachmentHandlerInterface` interface.\n    attachment_handler: Fusonic\\MessengerMailerBundle\\EmailAttachmentHandler\\FilesystemAttachmentHandler\n\nservices:\n    # Configure the services used as the `attachment_handler` above. This service is configured by default.\n    Fusonic\\MessengerMailerBundle\\EmailAttachmentHandler\\FilesystemAttachmentHandler:\n        arguments:\n            $attachmentsDirectory: \"%kernel.project_dir%/var/email-attachments\"\n```\n\nIf you want to use a different service for attachment handling, you can create your own and overwrite the default in your service configuration.\nYou can for example create a handler that would save the attachments with an abstract filesystem (e.g.: `thephpleague/flysystem`).\n\n## Usage\n\nThis bundle provides two classes for creating e-mails [AttachmentEmail](src/Component/Mime/AttachmentEmail.php) (extension of the Symfony `Email` class)\nand [TemplatedAttachmentEmail](src/Component/Mime/TemplatedAttachmentEmail.php) (extension of the Symfony `TemplatedEmail` class).\n\nInstead of using `attach`, `attachFromPath` and `addPart` you should use `addPersistedPart`.\nThis will persist the content depending on the `FilesystemAttachmentHandler`. This way the email can be safely handled asynchronously.\n\n```php\n\n$email = (new TemplatedAttachmentEmail())\n    -\u003efrom('hello@example.com')\n    -\u003eaddPersistedPart(new DataPart('Email text', 'filename.txt', 'plain/text'))\n    // ...\n    -\u003ehtml('...');\n```\n\n## Contributing\n\nThis is a subtree split of [fusonic/php-extensions](https://github.com/fusonic/php-extensions) repository. Please create your pull requests there.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffusonic%2Fphp-messenger-mailer-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffusonic%2Fphp-messenger-mailer-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffusonic%2Fphp-messenger-mailer-bundle/lists"}