Delta
Delta

Reputation: 227

How to send email message to two email id Address in zend Mail

Hi I am new in zend framework.

I have 2 email id's and i want to send message to 2 mail ids in zend mail

this is my code

$to1='[email protected]'
$to2='[email protected]'

 $mailObj = new Zend_Mail()

$mailObj->setSubject($subject)

mailObj->setBodyHtml($message)

$mailObj->addTo($to1, $name='test')

$mailObj->setFrom($from, $name = null)

$mailObj->send()

Upvotes: 2

Views: 2016

Answers (2)

konradwww
konradwww

Reputation: 691

You can define receiver as an array, for example:

$mailObj->addTo(array('[email protected]', '[email protected]'), 'test');

Upvotes: 1

liyakat
liyakat

Reputation: 11853

You have to add Recipients using array like below

 $recipients = array('[email protected]','[email protected]')

 $message = new Zend_Mail();
    $message->setFrom('[email protected]', 'My Fake Mailing List')
                                    ->setSubject($subject)
                                    ->setBodyText($body);

    foreach($recipients as $each_recipient){        
        $message->addTo($each_recipient);
    }

    $message->send();

for detail documentation you can check Zend_Mail - adding recipients

let me know if i can help you more.

Upvotes: 1

Related Questions