Magento 2 Disable Newsletter Subscription Success Email

In Magento 2, you’re able to enable/disable email for newsletter confirmation at Store -> Configuration -> Customers -> Newsletter. However, there is no setting to disable newsletter success email. In this tutorial, we will tell you how to do that.

You can get the package of this module in the end of article.

Disable newsletter subscription success email - Metagento

Where does Magento 2 send the subscription success email?

The sending email process can be found in file:

/vendor/magento/module-newsletter/Model/Subscriber.php method sendConfirmationSuccessEmail 

Editing Magento core file is a bad option, your edited code will be removed when you upgrade Magento. So we will create a simple module to do that.

In this post, we just tell you how to disable subscription success email. You can read this post to know how to create an extension on Magento 2

Assuming that we already have an extension named “Metagento_DisableNewsletterSuccess“, let’s find out what to do next.

1. Create new file: /app/code/Metagento/DisableNewsletterSuccess/etc/di.xml

2. Create new file: /app/code/Metagento/DisableNewsletterSuccess/etc/adminhtml/system.xml

This part will create a new setting, where you can enable/disable this function in the future.

3. Create new file: /app/code/Metagento/DisableNewsletterSuccess/Plugin/Newsletter/Model/Subscriber.php

In this file, we will check the setting first. If the function is enabled, we set the import mode to stop sending emails.

4. After creating all files, execute following commands to install the module.

5. Check again the configuration and enable the function

Disable newsletter subscription email by Metagento

You can get the package of this module on github here:  https://github.com/metagento/magento-2-disable-newsletter-success-email

We also provide a free extension which gives subscriber discount coupon codes.

 

Leave a Reply

Your email address will not be published.