cancel
Showing results for 
Search instead for 
Did you mean: 

In New Customer Welcome Email, set BCC

In New Customer Welcome Email, set BCC

Like order emails, I want to set Bcc in "a new customer welcome email" which the new customer receives when registers as a customer.

 

Magento version is 1.9.2.2

 

I found this below at public_html/app/code/core/Mage/Customer/Model/Customer.php

 

I added bold code. But it doesn't work. 

 

Please help me.

 

public function sendNewAccountEmail($type = 'registered', $backUrl = '', $storeId = '0', $bcc = '')
{
$types = array(
'registered' => self::XML_PATH_REGISTER_EMAIL_TEMPLATE, // welcome email, when confirmation is disabled
'confirmed' => self::XML_PATH_CONFIRMED_EMAIL_TEMPLATE, // welcome email, when confirmation is enabled
'confirmation' => self::XML_PATH_CONFIRM_EMAIL_TEMPLATE, // email with confirmation link
);
if (!isset($types[$type])) {
Mage::throwException(Mage::helper('customer')->__('Wrong transactional account email type'));
}

if (!$storeId) {
$storeId = $this->_getWebsiteStoreId($this->getSendemail, StoreId());
}

if (!$bcc) {
$bcc = array("sample@domain.com");
$this->addBcc($bcc);
}

 

$this->_sendEmailTemplate($types[$type], self::XML_PATH_REGISTER_EMAIL_IDENTITY,
array('customer' => $this, 'back_url' => $backUrl), $storeId, $bcc);

return $this;
}

3 REPLIES 3

Re: In New Customer Welcome Email, set BCC

Hi,

 

Please go through steps it will help you:

 

Step1 :

Go to  _sendEmailTemplate() function  in same page public_html/app/code/core/Mage/Customer/Model/Customer.php and modify that function. Please find below updated function :

 

protected function _sendEmailTemplate($template, $sender, $templateParams = array(), $storeId = null, $bcc= '')
    {
      
        $mailer = Mage::getModel('core/email_template_mailer');
        $emailInfo = Mage::getModel('core/email_info');
        $emailInfo->addTo($this->getEmail(), $this->getName());

 

        if($bcc) {

            $emailInfo->addBcc($bcc);

        }


        $mailer->addEmailInfo($emailInfo);

        // 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;
    }

 

Step2:

 

Remove your added code $this->addBcc($bcc);  on sendNewAccountEmail() function.

 

I think it will work for you. Please let me know if you have any issue.

 

Thanks,

Dibyajyoti

Re: In New Customer Welcome Email, set BCC

Thank you for the reply.

 

I got it.

 

 

Re: In New Customer Welcome Email, set BCC

Hi,

 

Please accept my solution if you satisfied my post.

 

Thanks,

Dibyajyoti