CLI Commands (EmailBundle) 

oro:email:update-associations 

To update email associations, use the following command:

php bin/console oro:email:update-associations

oro:email:generate-md5 

To generate and print MD5 hashes for email template contents from oro_email_template table, use the command below. These hashes can be used in email migrations.

php bin/console oro:email:generate-md5

oro:cron:email-body-sync 

To synchronizes email bodies, use the following command:

php bin/console oro:cron:email-body-sync

oro:debug:email:template 

To display a list of current email templates for an application or an exact template, use the following command:

php bin/console oro:debug:email:template

oro:debug:email:template:compile 

To render an email template, use the command below. Optionally, it can send a compiled email to the recipient’s email address.

php bin/console oro:debug:email:template:compile

oro:debug:email:template:entities 

To list all entity classes available when creating email templates, use the following command:

php bin/console oro:debug:email:template:entities

By default, the command lists all entity classes that have email.available_in_template set to true and are available when creating email templates.

To list entity classes that are not available when creating email templates:

php bin/console oro:debug:email:template:entities --unavailable

To output a plain list (one class name per line, suitable for piping):

php bin/console oro:debug:email:template:entities --plain
php bin/console oro:debug:email:template:entities --unavailable --plain

oro:debug:email:variables 

To display email template variables and entity field availability in email templates, use the following command:

php bin/console oro:debug:email:variables

When called without any options, the command shows the system variables table. The same result can be requested explicitly:

php bin/console oro:debug:email:variables --system

To show available entity variables for a specific entity:

php bin/console oro:debug:email:variables --entity-class='Oro\Bundle\UserBundle\Entity\User'

To include rendered values in the output, provide an entity ID (requires --entity-class):

php bin/console oro:debug:email:variables --entity-class='Oro\Bundle\UserBundle\Entity\User' --entity-id=1

To show entity variables for all configured entities at once:

php bin/console oro:debug:email:variables --all-entities

To show entity fields that are not available in email templates for a specific entity:

php bin/console oro:debug:email:variables --entity-class='Oro\Bundle\UserBundle\Entity\User' --unavailable

To show unavailable fields for all entities at once:

php bin/console oro:debug:email:variables --unavailable --all-entities

To output a plain tab-separated list (entity class and field name per line, suitable for piping):

php bin/console oro:debug:email:variables --unavailable --all-entities --plain

Note

The --entity-id option cannot be combined with --all-entities. The --entity-class option cannot be combined with --system.

oro:debug:email:filters 

To display all Twig filters allowed in email templates, use the following command:

php bin/console oro:debug:email:filters

oro:debug:email:functions 

To display all Twig functions allowed in email templates, use the following command:

php bin/console oro:debug:email:functions

oro:debug:email:tags 

To display all Twig tags allowed in email templates, use the following command:

php bin/console oro:debug:email:tags

oro:email:template:export 

To export email templates, use the following command:

php bin/console oro:email:template:export

oro:email:template:import 

To import email templates from the directory, use the following command:

php bin/console oro:email:template:import

oro:email:template:security-policy-check 

To check all email templates stored in the database for Twig sandbox security policy violations, use the following command:

php bin/console oro:email:template:security-policy-check

To check a specific template by name, pass the template name as an argument:

php bin/console oro:email:template:security-policy-check <template-name>

The command performs static analysis only. Some violations may appear only at runtime, and false positives or false negatives are possible.

Commands in Use (Examples) 

The following example uses SMTP settings and sends a message to the admin@example.com email address:

php bin/console oro:debug:email:template:compile order_confirmation_email --entity-id=16 --recipient=admin@example.com

The following example outputs EMAIL content to stdout:

php bin/console oro:debug:email:template:compile order_confirmation_email --entity-id=16

The following command displays a list of available templates:

php bin/console oro:debug:email:template

ID

NAME

ENTITY CLASS

TYPE

SYSTEM

VISIBLE

EDITABLE

PARENT

1

force_reset_password

Oro\Bundle\UserBundle\Entity\User

html

Yes

Yes

Yes

N/A

2

user_reset_password

Oro\Bundle\UserBundle\Entity\User

html

Yes

Yes

Yes

N/A

3

user_reset_password_as_admin

Oro\Bundle\UserBundle\Entity\User

html

Yes

Yes

Yes

N/A

4

user_change_password

Oro\Bundle\UserBundle\Entity\User

html

Yes

Yes

Yes

N/A

99

order_confirmation_email

Oro\BundleOrderBundle\Entity\Order

html

Yes

Yes

Yes

N/A

The following command displays information for a specific template:

php bin/console oro:debug:email:template order_confirmation_email
@name = order_confirmation_email
@entityName = Oro\Bundle\OrderBundle\Entity\Order
@subject = Your order has been received.
@isSystem = 1
@isEditable = 1

{%  extends 'base.html.twig' %}

{% block content %}
...
{% endblock %}

The following command displays system-wide variables:

php bin/console oro:debug:email:variable

Name

Title

Type

Value

system.appURL

Application URL

string

https://dev.oro.in/

system.currentDate

Current date

string

May 32, 2018

system.currentTime

Current time

string

12:03 PM

The following command displays class-based variables:

php bin/console oro:debug:email:variable --entity-class="Oro\Bundle\OrderBundle\Entity\Order"

System Variables

Name

Title

Type

Value

system.appURL

Application URL

string

https://dev.oro.in/

system.currentDate

Current date

string

Nov 1, 2021

system.currentDateTime

Current date & time

string

Nov 1, 2021, 10:43 AM

system.currentTime

Current time

string

10:43 AM

Entity Variables

Name

Title

Type

entity.acContactCount

Total times contacted

integer

entity.acContactCountIn

Total number of incoming contact attempts

integer

entity.acContactCountOut

Total number of outgoing contact attempts

integer

entity.acLastContactDate

Last contact datetime

datetime

entity.acLastContactDateIn

Last incoming contact datetime

datetime

entity.acLastContactDateOut

Last outgoing contact datetime

datetime

entity.baseSubtotalValue

Subtotal In Base Currency

money

entity.baseTotalValue

Total In Base Currency

money

entity.billingAddress

Billing Address

ref-one

entity.createdAt

Created At

datetime

entity.currency

Currency

string

entity.customer

Customer

ref-one

entity.customerNotes

Customer Notes

text

entity.customerUser

Customer User

ref-one

entity.disablePromotions

Disable Promotions

boolean

entity.estimatedShippingCostAmount

Estimated Shipping Cost Amount

money

entity.id

ID

integer

entity.identifier

Order Number

string

entity.internalStatus

Internal Status

enum

entity.organization

Organization

ref-one

entity.overriddenShippingCostAmount

Overridden Shipping Cost Amount

money

entity.owner

Owner

ref-one

entity.paymentTerm7c4f1e8e

Payment Term

manyToOne

entity.poNumber

PO Number

string

entity.shipUntil

Do Not Ship Later Than

date

entity.shippingAddress

Shipping Address

ref-one

entity.shippingMethod

Shipping Method

string

entity.shippingMethodType

Shipping Method Type

string

entity.sourceEntityClass

Source Entity Class

string

entity.sourceEntityId

Source Entity Id

integer

entity.sourceEntityIdentifier

Source Entity Identifier

string

entity.updatedAt

Updated At

datetime

entity.url.commerceView

oro.email.emailtemplate.variables.url.commerceView.label

string

entity.url.create

Entity Create Page

string

entity.url.index

Entity Grid Page

string

entity.url.update

Entity Update Page

string

entity.url.view

Entity View Page

string

entity.warehouse

Warehouse

manyToOne

entity.website

Website

ref-one

The following command displays entity-based variables:

php bin/console oro:debug:email:variable --entity-class="Oro\Bundle\OrderBundle\Entity\Order" --entity-id=16

Entity Variables

Name

Title

Type

Value

entity.acContactCount

Total times contacted

integer

entity.url.create

Entity Create Page

string

https://dev.oro.in/admin/order/create

entity.url.index

Entity Grid Page

string

https://dev.oro.in/admin/order/

entity.url.update

Entity Update Page

string

https://dev.oro.in/admin/order/update/16

entity.url.view

Entity View Page

string

https://dev.oro.in/admin/order/view/16

The following command exports all email templates:

php bin/console oro:email:template:export {PATH_TO_STORE_EXPORTED_TEMPLATES}
Found 99 templates for export

The following command exports a specific email template:

php bin/console oro:email:template:export --template order_confirmation_email {PATH_TO_STORE_EXPORTED_TEMPLATE}
Found 1 templates for export

The following command imports a specific email template:

php bin/console oro:email:template:import {PATH_TO_TEMPLATES}\order_confirmation_email.html.twig --force

The following command imports email templates from the specified folder:

php bin/console oro:email:template:import {PATH_TO_TEMPLATES} --force
Found 999 templates
"authentication_code" updated
...
"order_confirmation_email" updated