Topics
- configuring swiftmailer
- OroEmailBundle
- OroNotificationBundle
- using email configuration annotations
- using Twig functions in templates
- running Job Queue based on JMSQueueBundle
Changes
src/Acme/Bundle/TaskBundle
DataFixtures
data
email
create_task.html.twig (created)
ORM
LoadEmailTemplates (created)
Resources
config
entity_output.yml (created)
-
Configure swiftmailer in parameters.yml, for example:
mailer_transport: smtp mailer_host: smtp.googlemail.com mailer_port: 465 mailer_encryption: tls mailer_user: [email protected] mailer_password: password
-
Add Acme/Bundle/TaskBundle/Resources/config/entity_output.yml with data of Task entity
-
Add Acme/Bundle/TaskBundle/DataFixtures/data/email/create_task.html.twig
-
Add Acme\Bundle\TaskBundle\DataFixtures\ORM\LoadEmailTemplates
-
Load email templates
app/console doctrine:fixture:load --append --fixtures src/Acme/src/Acme/Bundle/TaskBundle/DataFixtures/ORM/
-
Go to System -> Emails -> Templates and check created template
-
Update fields in Task to support them in email templates
* @ConfigField(
* defaultValues={
* "email"={"available_in_template"=true}
* }
* )
-
Run command oro:entity-config:update
-
Go to System -> Entites and check that fields are available in email templates
-
Go to System -> Notification -> Create notification rule
-
Go to System -> Job Queue and clock "Run daemon"
-
Create task and check your mail inbox