Can you guys guide me on how to properly do this. I created a module to extend the EmailNotification model but its not working. I'm getting error during compile:

Interface '[Namespace]\[Module]\Model\EmailNotificationInterface' not found in /app/code/[Namespace]/[Module]/Model/EmailNo
tification.php on line 8

What I'm trying to achieve is to send email notification to admin every time a customer registers. I'm overriding this model just to modify the private function sendEmailTemplate to addBcc when it sends welcome email to the newly registered customer.


<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
  <preference for="Magento\Customer\Model\EmailNotification" type="[Namespace]\[Module]\Model\EmailNotification" />


* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
namespace [Namespace]\[Module]\Model;

class EmailNotification implements EmailNotificationInterface

Note: I copied everything on EmailNotification.php and just modified some parts.

1 Answer 1


Create a plugin for \Magento\Customer\Model\EmailNotification. Update di.xml

<type name="\Magento\Customer\Model\EmailNotification">
    <plugin name="disable-email-notification" type="Module\Model\Plugin\EmailNotification" sortOrder="1"/>

then create the plugin

class EmailNotification
    public function aroundNewAccount(\Magento\Customer\Model\EmailNotification $subject, \Closure $proceed)
        return $subject;
  • Its a private function. Does plugin work on private function?
    – Jim
    Commented Jun 11, 2018 at 19:27
  • which function use ?
    – user68116
    Commented Jun 11, 2018 at 19:46
  • private function sendEmailTemplate This is the function I want to modify.
    – Jim
    Commented Jun 11, 2018 at 19:59
  • why this function modify ?
    – user68116
    Commented Jun 11, 2018 at 20:04
  • Private functions cannot be modified with a plugin nor can they be overriden by extending the class. Good job magento...
    – omsta
    Commented Jul 16, 2019 at 9:27

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.