Search code examples
shopwareshopware6

How to send a mail via plugin using templates in shopware 6


I created a plugin in which I would like to send a Mail to a customer.

It would be really convenient to use the email templates, since they are editable in the admin panel. The problem here is that the email templates need a type and I could not find a generic type, but only specific ones.

Should I create my own email template type? Or is there another way to use a template? Do I have to do it without Templates?

I have also found a really useful tutorial.


Solution

  • To add a new type of email template which you can then select in the admin panel, you have to use a migration. See here for an example.

    Then you can use the description in the section "An advanced email service for Shopware 6" in the tutorial to trigger the mail.