{"id":21012703,"url":"https://github.com/disjfa/mail-bundle","last_synced_at":"2025-12-30T10:27:42.392Z","repository":{"id":56969485,"uuid":"219061100","full_name":"disjfa/mail-bundle","owner":"disjfa","description":"Mail bundle for symfony applications.","archived":false,"fork":false,"pushed_at":"2019-11-21T20:22:37.000Z","size":48,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-20T11:44:11.351Z","etag":null,"topics":["foundation-emails","inky","inline-css","mailer","symfony","symfony-bundle"],"latest_commit_sha":null,"homepage":"","language":"CSS","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/disjfa.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":"2019-11-01T20:53:13.000Z","updated_at":"2019-12-09T01:58:43.000Z","dependencies_parsed_at":"2022-08-21T06:40:14.716Z","dependency_job_id":null,"html_url":"https://github.com/disjfa/mail-bundle","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disjfa%2Fmail-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disjfa%2Fmail-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disjfa%2Fmail-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disjfa%2Fmail-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/disjfa","download_url":"https://codeload.github.com/disjfa/mail-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243437968,"owners_count":20290864,"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":["foundation-emails","inky","inline-css","mailer","symfony","symfony-bundle"],"created_at":"2024-11-19T09:38:16.073Z","updated_at":"2025-12-30T10:27:42.347Z","avatar_url":"https://github.com/disjfa.png","language":"CSS","readme":"# Mail bundle\n\n[![Check on packagist][packagist-badge]][packagist]\n[![MIT License][license-badge]][LICENSE]\n\n[![Watch on GitHub][github-watch-badge]][github-watch]\n[![Star on GitHub][github-star-badge]][github-star]\n[![Tweet][twitter-badge]][twitter]\n\n### Why is this bundle here\n\nIn every project i need to build a way to send emails. Now symfony has released the [Mime Component](https://symfony.com/doc/current/components/mime.html) and the [Mailer Component](https://symfony.com/doc/current/components/mailer.html). Lets see what we can do to make live easier for us people who send emails.\n\n### Instalation\n\n```\ncomposer require disjfa/mail-bundle\n```\n\n### Setup the interface\n\nSetup the routes in `config/routes/disjfa_mail.yaml`. Here you can edit emails setup in your application.\n\n```yaml\ndisjfa_mail:\n    resource: '@DisjfaMailBundle/Controller/'\n    type: annotation\n    prefix: '/admin'\n```\n\n### Make you own template\n\nCreate a class that extends the `MailInterface`. Implement the name, subject and content as you want. You can inject the `Translator` to add simple translations or the twig `Environment` to render out templates.\n\n```php\n\u003c?php\nnamespace Disjfa\\MailBundle\\Mail;\n\ninterface MailInterface\n{\n    public function getName();\n    public function getSubject();\n    public function getContent();\n}\n```\n\nIn your templates there should be no twig variables. Escape those, like this: `{{ '{{' }} email {{ '}}' }}`. All the variables used are parsed and collected. The original variables are the only ones that should be used.\n\nIf you made a class it will be autoload in the `MailCollection` collection. And so editable if you have set up some routes for the interface.\n\n### Sending emails\n\nNext up is sending emails. In your code just make a message or function that sets up the email.\n\n```php\nuse Disjfa\\MailBundle\\Mail\\MailFactory;\nuse Disjfa\\MailBundle\\Mail\\MailService;\n\nfunction myFunction(MailFactory $mailFactory, MailService $mailService)\n{\n    $mail = $mailFactory-\u003efindByName('name');\n    $mailService-\u003esend($mail, [\n         'param1' =\u003e 'value',\n         'param2' =\u003e 'value',\n    ], 'info@example.com');\n}\n```\n\nAnd done! Mail sent. Now it is time to setup emails and make more in your application.\n\n### Extend the templates\n\nYou can manage the templates as is. But you probably want to integrate the files in your own system. Just create a file in your application in `templates/bundles/DisjfaMailBundle/layout.html.twig` and add a body block.\n\n```twig\n\u003c!doctype html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n...\n\u003c/head\u003e\n\u003cbody\u003e\n{% block body %}\n\n{% endblock %}\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nAnd you are good to go. Or you can just [extend](https://twig.symfony.com/doc/2.x/tags/extends.html) your own template. Just make sure you use a block named `body`. You can also just extend the rest of the files as you wish. Just name them like we set up the files. \n\n### One thing missing\n\nOne thing missing is sending the emails. We do not have to set up the mailing bit of the application. You can do that yourself. Check the [transports](https://symfony.com/doc/current/components/mailer.html#transport) on how to set up your own mailer as you wish.\n\n### And that is about it.\n\nNow you can make your own emails. Set them up. Create a method to send emails. And when you have set up your favorite mailer you can send them!\n\n### Help\n\nThis bundle is a nice way to extend your workflow. But it can be improved. If you have any ideas or solutions to do so don't be shy and tell us! We can only make stuff better in the end.\n\n### Enjoy!\n\nUse the bundle. Check what the bundle does. Fork. Make your own. This is here just to make live easier for us all. Make something beautiful.\n\n[packagist-badge]: https://img.shields.io/packagist/v/disjfa/mail-bundle\n[packagist]: https://packagist.org/packages/disjfa/mail-bundle\n[license]: https://github.com/disjfa/mail-bundle/blob/master/LICENSE\n[license-badge]: https://img.shields.io/github/license/disjfa/mail-bundle.svg\n[github-watch-badge]: https://img.shields.io/github/watchers/disjfa/mail-bundle.svg?style=social\n[github-watch]: https://github.com/disjfa/mail-bundle/watchers\n[github-star-badge]: https://img.shields.io/github/stars/disjfa/mail-bundle.svg?style=social\n[github-star]: https://github.com/disjfa/mail-bundle/stargazers\n[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/disjfa/mail-bundle.svg?style=social\n[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20mail-bundle!%20-%20Cool%mail%20templates%20for%20symfony%20template!%20Thanks%20@disjfa%20https://github.com/disjfa/mail-bundle%20%F0%9F%A4%97\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdisjfa%2Fmail-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdisjfa%2Fmail-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdisjfa%2Fmail-bundle/lists"}