2

In Magento 2 how to disable newsletter subscription success email.

Newsletter subscribers after providing email address the address to added to mail newsletter management provider and they will verify the email address.

so i do not want to send any welcome or thank email from magento store.

how to stop sending the thank you for subscription email to subscribers?

4

Magento doesn’t have default functionality to stop sending newsletter emails.

Below I show an example of how to disable newsletter subscription emails.

Create a custom module and add di.xml

Override Subscriber.php

app/code/Vendor/Module/etc/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Newsletter\Model\Subscriber">
        <plugin name="myplugin" type="Vendor\Module\Newsletter\Model\Subscriber" sortOrder="1" disabled="false"/>
    </type>
</config>

Now create Subscriber.php

app/code/Vendor/Module/Newsletter\Model\Subscriber.php

<?php

namespace Vendor\Module\Newsletter\Model;

use Magento\Newsletter\Model\Subscriber as SubscriberModel;

class Subscriber
{
    /**
     * @param SubscriberModel $oSubject
     * @param callable $proceed
     */
    public function aroundSendConfirmationRequestEmail(SubscriberModel $oSubject, callable $proceed) {}

    /**
     * @param SubscriberModel $oSubject
     * @param callable $proceed
     */
    public function aroundSendConfirmationSuccessEmail(SubscriberModel $oSubject, callable $proceed) {}

    /**
     * @param SubscriberModel $oSubject
     * @param callable $proceed
     */
    public function aroundSendUnsubscriptionEmail(SubscriberModel $oSubject, callable $proceed) {}
}

Now run following commands

php bin/magento setup:di:compile
php bin/magento cache:clean

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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