PHP email script with array will not run.

Hi there,

Wondering if you can help… I have a script that runs in a Cronjob but since I added two new emails to the array it does not work and i am mystified!

The line in question is:
[php]$email_list = array(‘[email protected]’,‘[email protected]’,‘[email protected]’,‘[email protected]’,‘[email protected]’,‘[email protected]’,‘[email protected]’);[/php]

When I replace it with this line it works:
[php]$email_list = array(‘[email protected]’,‘[email protected]’,‘[email protected]’,‘[email protected]’);[/php]

When I then changed the line to:-
[php]$email_list = array(‘[email protected]’,‘[email protected]’,‘[email protected]’);
it also works![/php]

Can anyone help?
Thanks in anticipation,
Allan

How do you send the email?

Hi,
Thank you for responding.

The email is sent by the following portion of script:
[php]
foreach($email_list as $email_address){
$email->AddAddress( $email_address );
}
$email->Send();[/php]

So, PHPMailer from the look of the snippet.

Are you checking for success or errors, or just relying on them making it to the mailbox?

Hi there,
I was just relying on them making it to the mailbox.

I had a thought that the web host may be blocking multiple emails… There are only 7 - but I am checking with them.

Thanks for your input.

You may want to add this to your script, just in case:

[php] if (! $email->send()) {
echo "Mailer Error: " . $email->ErrorInfo;
} else {
echo “Message sent!”;
}[/php]

Granted the echo’s will need to be added to a log file.

Thank you so much!
I will add the check!
Allan

Sponsor our Newsletter | Privacy Policy | Terms of Service