Mails are seemingly not sent
Permalink 1 user found helpful
I have inherited a project that is running v5.4.1.1 and has been so heavily customized that I'm afraid to upgrade.
There is a job that runs and then sends a notification email. Heres the code for sending the emails:
This code only seems to send emails to the last person in the $emailNotificationRecipients array.
I've tried various things:
* Commenting out the last 2 names. The first person does indeed receive the email
* Comment out the last name. The 2nd person receives the email.
* Send out one email with all recipients instead of multiple emails. Does not work.
Is there a bug in the mail helper/Zend email or in my code somewhere?
I'm thinking about just using built-in PHP mail() to do this, but then have to recreate everything. blah.
Any help is appreciated.
There is a job that runs and then sends a notification email. Heres the code for sending the emails:
$emailNotificationRecipients = array( 'John Doe'=>'johndoe@email.com' ,'Jane Doe'=>'janedoe@email.com' ,'Juan Doe'=>'juan@somewhere.com' ); foreach ($emailNotificationRecipients as $name=>$email) { $mh = Loader::helper('mail'); $mh->to($email,$name); $mh->from( 'no-reply@thesite.com' ); $mh->addParameter('message_field', $this->logger); $mh->load('alert_account_report'); $mh->setSubject('Daily Report' ); $mh->sendMail(); unset($mh); }
This code only seems to send emails to the last person in the $emailNotificationRecipients array.
I've tried various things:
* Commenting out the last 2 names. The first person does indeed receive the email
* Comment out the last name. The 2nd person receives the email.
* Send out one email with all recipients instead of multiple emails. Does not work.
Is there a bug in the mail helper/Zend email or in my code somewhere?
I'm thinking about just using built-in PHP mail() to do this, but then have to recreate everything. blah.
Any help is appreciated.
Actually you could probably just reset the mail and resend