Deprecation: #845 - MailHandler
See Issue 845
Description
The class \Extcode\ is deprecated. The emails at
the end of an order are sent by \Extcode\, which
uses the same classes as the emails on status changes:
\Extcode\loads the configuration of the emails to the buyer and to the seller. The implementationCart\ Configuration\ Loader\ Mail Configuration Loader Interface \Extcode\reads the settings of the new site setCart\ Configuration\ Loader\ Site Sets\ Mail Configuration Loader extcode/from the site of the storage page of the order, see below. It works without request too, e.g. in a command.cart- mail \Extcode\sends the email. It takes the attachments as new argumentCart\ Mail\ Mailer $attachments.
The listener \Extcode\ sends the
emails with the Order if the feature toggle
cart. is enabled:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['features']['cart.useNewOrderMailSender'] = true;
Without the toggle the listener uses the Mail as before, so a
Mail replaced in the dependency injection keeps working.
The site set extcode/ defines typed settings for the addresses,
which can be edited in the backend module "Site Settings":
extcode:
cart:
mail:
buyer:
fromName: 'Shop'
fromAddress: 'shop@example.com'
ccAddress: []
bccAddress: ['archive@example.com']
replyToAddress: []
seller:
fromName: 'Shop'
fromAddress: 'shop@example.com'
toAddress: ['orders@example.com']
ccAddress: []
bccAddress: []
The addresses are lists, not comma separated strings. plugin.
and the email settings of the cart plugin (FlexForm) are not used by the
Order. Attachments are still configured in
plugin. and attach.
Impact
Sending an email with the Mail triggers a deprecation. The class
and the feature toggle will be removed in cart 13.0, the emails are then
always sent by the Order.
The Mail still works. It sends the emails with the
Order, using the addresses of its getters and setters.
The templates of the emails are not changed. With the feature toggle:
- The addresses are read from the site settings of the set
extcode/instead of TypoScript and the FlexForm of the plugin.cart- mail - The seller needs
extcode.. Without it an error is written to the order log of each order. Previously the email to the seller was skipped.cart. mail. seller. to Address - If the storage page of the order is in no site, an error is written to the order log.
- Invalid email addresses in the configuration are written to the order log before the email is sent. Previously sending the email failed.
- Errors of the template, e.g. a view helper which needs a request, and of
listeners of the
Attachmentare written to the order log with the reason, the email is not sent. Previously a failing listener of theEvent Attachmentstopped the order.Event
Affected Installations
All installations which want to use the Order before cart 13.0,
and all installations with extensions which use or replace the Mail,
e.g. to send the emails of an order again.
Migration
Add the site set extcode/ to the dependencies of the site, move
the addresses from plugin. and the cart plugin to the site
settings extcode. and enable the feature toggle
cart..
Extensions which replace the Mail move the changes to an own
\Extcode\
implementation or to a listener of the Finish. Extensions which use
the Mail use the Order:
use Extcode\Cart\Mail\OrderMailSender;
public function __construct(
private readonly OrderMailSender $orderMailSender,
) {}
// before: $mailHandler->setCart($cart); $mailHandler->sendBuyerMail($orderItem);
$this->orderMailSender->sendBuyerMail($orderItem, $cart);
$this->orderMailSender->sendSellerMail($orderItem, $cart);
To send an email with an own configuration, e.g. other addresses, create a
\Extcode\ or
\Extcode\ and send it with
Order.