How to make the transactional email being sent asynchronously or synchronously?

invoice-sender
asynchronous-email-sending
transactional-email
(Dmitry Fedyuk) #1
  1. Open the backend «Stores» → «Configuration» page.
  • Go to the «Sales» → «Sales Emails» section.
  • Locate the «General Settings» → «Asynchronous sending» option and set it to the proper value («Yes» or «No»).

The default value is «No»:
https://github.com/magento/magento2/blob/135f967/app/code/Magento/Sales/etc/config.xml#L30-L30

How is it used:

https://github.com/magento/magento2/blob/135f967/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php#L82-L101


https://github.com/magento/magento2/blob/135f967/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php#L84-L103

0 Likes

How does email scheduling work in cron job?
How is a confirmation email sent on an order placement?
How are the «send_email» (setSendEmail, getSendEmail) / «email_sent» (setEmailSent, getEmailSent) flags used for an order?
(Dmitry Fedyuk) #2

See also:

0 Likes

(Dmitry Fedyuk) split this topic #3

A post was split to a new topic: «How " * - if $forceSyncMode parameter is set to TRUE" is set? Where?»

0 Likes

(Dmitry Fedyuk) #4

The asynchronous email sending solves the problems like this:

In my production instance calls like $mailer->send(); takes around 40 to 60 seconds.
https://stackoverflow.com/questions/29893585

0 Likes

(Dmitry Fedyuk) #5

Please note that the asynchronous email sending does not work correctly for non-English stores:

0 Likes

(Dmitry Fedyuk) #6

How are the send_email (setSendEmail, getSendEmail) / email_sent (setEmailSent, getEmailSent) flags used for an order?

0 Likes