By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,216 Members | 1,032 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,216 IT Pros & Developers. It's quick & easy.

emails

zorgi
Expert 100+
P: 431
Hello guys

I have to send HTML email to over 1000 email addresses and I believe that at some point server will stop sending them even if my script works perfect on fewer email addresses. Basically I am looping through an array like this

[PHP]
$message = "some html";
$emails = array("email1@example.com", "email2@example.com",.... );
foreach($emails_array as $email){

$headers = 'MIME-Version: 1.0";
$headers .= 'Content-type: text/html; charset=iso-8859-1";
$headers .= 'To: $email' . "\r\n";
$headers .= 'From: Buldog Promo<name@example.com>' ";
mail($email, $subject, $message, $headers);
}
[/PHP]

My question is:
What is max number of elements array $emails should hold?
OR
Do you know way around this problem

Thank you for your Help
Oct 2 '08 #1
Share this Question
Share on Google+
5 Replies


Markus
Expert 5K+
P: 6,050
Best thing you could do is contact your hosting provider and find out if they have a cap on how many emails you can send, say, per hour. PHP itself, as far as I know, doesn't limit the emails, but it will crash if you don't set the max execution time.

Cheers,
Markus.
Oct 2 '08 #2

Atli
Expert 5K+
P: 5,058
Hi.

PHP doesn't limit it, but like Markus says, your host might.

You could also try sending to multiple email addresses at once.
See the manual for examples.

Or better yet, you could try one of the mailer classes, like PHPMailer. Usually works a lot better than the mail function. The manual even mentions that using the mail function with complex mails, like HTML mails, is not recommended.
Oct 2 '08 #3

Markus
Expert 5K+
P: 6,050
Hi.

PHP doesn't limit it, but like Markus says, your host might.

You could also try sending to multiple email addresses at once.
See the manual for examples.

Or better yet, you could try one of the mailer classes, like PHPMailer. Usually works a lot better than the mail function. The manual even mentions that using the mail function with complex mails, like HTML mails, is not recommended.
You should be on PHPMailer's payroll, considering all the effort you put in to marketing them.

:P

Markus.
Oct 2 '08 #4

pbmods
Expert 5K+
P: 5,821
Heya, Zorgi.

Is your script completing without any errors? Perhaps it times out after 1000 or so emails?
Oct 2 '08 #5

zorgi
Expert 100+
P: 431
Heya, Zorgi.

Is your script completing without any errors? Perhaps it times out after 1000 or so emails?
Thank you guys,

Script works great. All information I got here was very useful and needed. I would also recommend PHPMailer if you don't want your emails to end up in someones junk mail. Also... do contact your host and ask them how many emails you can send an hour.
Oct 10 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.