TASK
Set BCC for the welcome emails that are sent to the new customers when they register new accounts.
SOLUTIONS
The 1st method:
In your custom module
– Rewrite model Mage_Customer_Model_Customer in config.xml
<config> <global> <models> ... <customer> <rewrite> <customer>Vendor_Namespace_Model_Customer_Customer</customer> </rewrite> </customer> ... </models> </global> </config>
– Create Customer.php in path Vendor/Namespace/Model/Customer/Customer and override function _sendEmailTemplate
class Vendor_Namespace_Model_Customer_Customer extends Mage_Customer_Model_Customer { ... protected function _sendEmailTemplate($template, $sender, $templateParams = array(), $storeId = null, $customerEmail = null) { $customerEmail = ($customerEmail) ? $customerEmail : $this->getEmail(); /** @var $mailer Mage_Core_Model_Email_Template_Mailer */ $mailer = Mage::getModel('core/email_template_mailer'); $emailInfo = Mage::getModel('core/email_info'); $emailInfo->addTo($customerEmail, $this->getName()); $mailer->addEmailInfo($emailInfo); //add bbc $mailer->addBcc('[email protected]'); // Set all required params and send emails $mailer->setSender(Mage::getStoreConfig($sender, $storeId)); $mailer->setStoreId($storeId); $mailer->setTemplateId(Mage::getStoreConfig($template, $storeId)); $mailer->setTemplateParams($templateParams); $mailer->send(); return $this; } ... }
The 2nd method:
Add the following code
$storeId=Mage::app()->getStore()->getId(); $emailTemplateId='Youe email temlate'; //Multiple BCC email address $add_bcc=array("[email protected]","[email protected]"); //Multiple CC email address $add_cc=array("[email protected]","[email protected]"); $email='[email protected]'; $sender = Array('name' => 'test','email' => '[email protected]'); $mailSubject='Your subject'; $vars = Array('name' => 'Your message'); $translate=Mage::getModel('core/email_template'); $translate->getMail()->addCc($add_cc); $translate->setTemplateSubject($mailSubject) ->addBCC($add_bcc) ->sendTransactional($emailTemplateId, $sender, $email, null, $vars, $storeId); $translate->setTranslateInline(true);