Hi,
What is the best way to disable the welcome email that customer receives upon registration?
I want to use a marketing software platform to handle it, however, I do not want our customers to receive two different welcome emails.
Thank you.
Solved! Go to Solution.
Use the below code in the di.xml file at app/code/Vendor/Extension/etc/adminhtml
<?xml version="1.0" encoding="utf-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="\Magento\Customer\Model\EmailNotification"> <plugin name="disable-email-notification" type="Vendore\Extension\Plugin\EmailNotification" sortOrder="1"/> </type> </config>Use the below code in the EmailNotification.php file at app/code/Vendor/Extension/Plugin
<?php namespace Vendore\Extension\Plugin; class EmailNotification { public function aroundNewAccount(\Magento\Customer\Model\EmailNotification $subject, \Closure $proceed) { return $subject; } }
Use the below code in the di.xml file at app/code/Vendor/Extension/etc/adminhtml
<?xml version="1.0" encoding="utf-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="\Magento\Customer\Model\EmailNotification"> <plugin name="disable-email-notification" type="Vendore\Extension\Plugin\EmailNotification" sortOrder="1"/> </type> </config>Use the below code in the EmailNotification.php file at app/code/Vendor/Extension/Plugin
<?php namespace Vendore\Extension\Plugin; class EmailNotification { public function aroundNewAccount(\Magento\Customer\Model\EmailNotification $subject, \Closure $proceed) { return $subject; } }