Download the PHP package disjfa/mail-bundle without Composer
On this page you can find all versions of the php package disjfa/mail-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download disjfa/mail-bundle
More information about disjfa/mail-bundle
Files in disjfa/mail-bundle
Package mail-bundle
Short Description Mail bundle for symfony, can also be use in glynn-admin-symfony
License MIT
Homepage https://github.com/disjfa/mail-bundle
Informations about the package mail-bundle
Mail bundle
Why is this bundle here
In every project i need to build a way to send emails. Now symfony has released the Mime Component and the Mailer Component. Lets see what we can do to make live easier for us people who send emails.
Instalation
Setup the interface
Setup the routes in config/routes/disjfa_mail.yaml
. Here you can edit emails setup in your application.
Make you own template
Create 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.
In 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.
If 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.
Sending emails
Next up is sending emails. In your code just make a message or function that sets up the email.
And done! Mail sent. Now it is time to setup emails and make more in your application.
Extend the templates
You 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.
And you are good to go. Or you can just extend 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.
One thing missing
One 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 on how to set up your own mailer as you wish.
And that is about it.
Now 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!
Help
This 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.
Enjoy!
Use 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.
All versions of mail-bundle with dependencies
ramsey/uuid Version ^3
symfony/form Version ^4|^5
symfony/mailer Version ^4|^5
symfony/mime Version ^4|^5
symfony/orm-pack Version ^1.0
symfony/translation Version ^4|^5
symfony/twig-bundle Version ^4|^5
symfony/validator Version ^4|^5
twig/cssinliner-extra Version ^2.12
twig/extra-bundle Version ^2.12
twig/inky-extra Version ^2.12