Need to send multiple emails

Permalink 1 user found helpful
Hi Everybody,

I need to send multiple emails after form submission, so i have tried the code given below. But its not working and i don't know why this is not working. If anyone came across this problem before or anyone having a better solution for sending multiple emails, any help would be appreciated

$email_id = explode(",",$this->recipientEmailId);
            $recipient_name = explode(",",$this->recipientName);
             for($i=0;$i<count($email_id);$i++)
{
$mh = Loader::helper('mail');
                        $mh->to( $email_id[$i] );
                        $mh->from( $formFormEmailAddress );
                        $mh->addParameter('formName', $this->surveyName);
                        $mh->addParameter('questionSetId', $this->questionSetId);
                        $mh->addParameter('questionAnswerPairs', $questionAnswerPairs);
                        $mh->load('block_form_submission');
                        $mh->setSubject(t('%s Form Submission', $this->surveyName));
                        @$mh->sendMail();
               }



Thank you

SVijay