tags:

views:

308

answers:

4

When users subscribe to the newsletter on A Magento Store they receive a confirmation email. Is it possible to prevent this email from being sent?

There doesn't seem to be an option in the back end for this.

A: 

Do you mean success or confirmation (need to confirm to get newsletter) email?

The latter can be switched off in Configuration->Newsletter

macki
I mean the success email. I have already turned the confirmation off in admin.
a1anm
+2  A: 

The file you want to override is Mage_Newsletter_Model_Subscriber. Create a class that overrides that model, and then replace two methods like this:

<?php

class Somepackage_Somemodule_Models_Subscriber extends Mage_Newsletter_Model_Subscriber {

    public function sendConfirmationSuccessEmail() {
        return $this;
    }

    public function sendUnsubscriptionEmail() {
        return $this;
    }    
}

This will disable newsletter subscription (and unsubscription) emails to customers.

Hope that helps!

Thanks, Joe

Joseph Mastey
Thanks Joe. Where exactly should I place this code? In the Mage_Newsletter_Model_Subscriber file?Cheers!
a1anm
I think Joe was saying that you should create your own module. If you haven't done that before do some google searches on how to create a magento module. I will also mention that if you follow Joe's suggestion, your module's config.xml file will need to include a rewrite of Mage_Newsletter_Model_Subscriber. See this link to find out how to do that: http://www.exploremagento.com/magento/override-a-magento-core-block-class.php
sdek
A: 

A much easier way, although it is kind of a hack, is to look for the method sendConfirmationSuccessEmail which sends the emails. It is found in:

app/code/core/Mage/Newsletter/Model/Subscriber.php

The only thing you gotta do is to put a return true at the first line of the method.

Shane
A: 

Isn't there a way to do this through the Magento Configuration settings, instead of modifying the magento core?

Fire Pits