Is there any way to stop to sending email to customer while importing customer ?

Is Disable Email Communication : OFF this helpful for that ?

  • How you import the customer?
    – Amit Bera
    Commented May 23, 2019 at 8:56

1 Answer 1


If you want to stop sending the email during Customer import then you have to work on Magento\Customer\Model\EmailNotification:newAccount().

Create an around plugin on Magento\Customer\Model\EmailNotification:newAccount() method and stop execute of this method.

And add Import Url full Action name as a condition on this plugin.

Plugin Class


namespace Devamitbera\Systemconfig\Plugin;

use Magento\Customer\Api\Data\CustomerInterface;
use Magento\Customer\Model\EmailNotification as CustomerEmailNotification;

class EmailNotification {

    protected $request;
    public function __construct(
        \Magento\Framework\App\Request\Http $request
    ) {
        $this->request = $request;

    public function aroundNewAccount(
        CustomerEmailNotification $subject,
        \Closure $proceed,    
        CustomerInterface $customer,
        $type = CustomerEmailNotification::NEW_ACCOUNT_EMAIL_REGISTERED,
        $backUrl = '',
        $storeId = 0,
        $sendemailStoreId = null
    ) {

        $action = $this->request->getFullActionName();
        // if import URL  Full Action pathc then  donot excute rest of
        //  all code
        if($action == 'MY_ACTION_FULLNAME'){
            return $subject;
        return $proceed(
  • I am importing customers using magento's default import feature, How do I stop mail sending during import process Commented Apr 1, 2020 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.