Emails Not Sent with Magento_CustomerSampleData - Alekseon/magento2-widget-forms GitHub Wiki
Magento’s Magento_CustomerSampleData module includes a plugin that intercepts all email sending via \Magento\Framework\Mail\TransportInterface::sendMessage()
.
Specifically, the plugin is defined as:
public function aroundSendMessage(
\Magento\Framework\Mail\TransportInterface $subject,
\Closure $proceed
) {
return $this->appState->isAreaCodeEmulated() ? null : $proceed();
}
This means that if you're using \Magento\Framework\App\State::emulateAreaCode()
to send emails with the 'frontend' area, then no emails will actually be sent, and you won't get any error or warning.
Impact on Alekseon_CustomFormsEmailNotification
Our module, Alekseon_CustomFormsEmailNotification, emulates the frontend area in order to send transactional emails using Magento's built-in mechanisms.
When Magento_CustomerSampleData is detected, our module will display a warning in the Magento Admin panel (added in Alekseon_CustomFormsEmailNotification in version 100.1.15):
Solution
To ensure email delivery works correctly with Alekseon_CustomFormsEmailNotification, you have two options:
Disable the Magento_CustomerSampleData module in non-demo environments:
bin/magento module:disable Magento_CustomerSampleData
bin/magento cache:flush
Completely remove it if no sample data is needed:
composer remove magento/module-customer-sample-data
bin/magento setup:upgrade
We strongly recommend disabling Magento_CustomerSampleData in staging, UAT, or production environments where email sending is expected to function properly.
If email functionality is being tested and emails are not arriving, please verify whether this module is active.