1

I am sending mail by following code,

$template = Mage::getModel('core/email_template')->loadDefault('customer_email');
$template->addSenderName("MyName");
$template->addSenderEMail("myname@gmail.com");
$template->send("tomail@some.com","toname",$data);

Can i add Bcc and Cc to this $template.if yes or no how it can be?

3

Use the ->addBcc() on the template object to set the bcc recipient. There isn't an equivalent cc method, you instead can pass an array for the email addresses and an array for the names to the ->send() method:

$template = Mage::getModel('core/email_template')->loadDefault('customer_email');
$template->addSenderName("MyName");
$template->addSenderEMail("myname@gmail.com");
$template->addBcc("some@email.com");
$template->send(array("tomail@some.com","someother@email.com"),array("toname",$othername),$data);
  • just now I saw that method, anyway thank you for your time.. – Manikandan Arunachalam Dec 19 '14 at 12:52
0

You can add cc and bcc in your email using the following piece of code

$template = Mage::getModel('core/email_template')->loadDefault('email_template_identifier');
$template->getMail()->addCc('your.cc.email@example.com');
$template->addBcc('your.bcc.email@example.com');

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.