1

This is my code:

$mail = Mage::getModel('core/email');
        $mail->setToName('My Name');
        $mail->setToEmail('[email protected]','[email protected]');
//        $mail->setToEmail($this->getStoreSalesEmail(), $this->getCustomerEmail());
        $mail->setBody($html);
        $mail->setSubject('You have changed your subscription date');
        $mail->setFromEmail('[email protected]');
//        $mail->setFromName("Msg to Show on Subject");
        $mail->setType('html');// YOu can use Html or text as Mail format

I received the email to this address: [email protected]. But for [email protected] I do not receive any email. Why ?

1 Answer 1

3

You can send using below code:

$recipients = [
    '[email protected]' => 'Recipient1 Name',
    '[email protected]' => 'Recipient2 Name'
];

Mage::getModel('core/email_template')->sendTransactional(
    $templateId,
    $sender,
    array_keys($recipients),
    array_values($recipients),
    $vars,
    $store->getId()
);

EDIT:

$mail->setToEmail(array('[email protected]','[email protected]'));
3
  • I am not using a template. I am just sending an email with a short text to multiple addresses. Thats why i am using Mage::getModel('core/email'), not Mage::getModel('core/email_template') Commented Jun 24, 2016 at 8:39
  • updated answer check it Commented Jun 24, 2016 at 8:43
  • Thx a lot , this works for me :) Commented Jun 24, 2016 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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