473,378 Members | 1,434 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Script times out when sending bulk email

hi friends I want to send thousands of mails I use following function to send the mail but it returns following error

Warning: mail() [function.mail]: SMTP server response: 552 Too many recipients in c:\wamp\www\emailer\emailer.php on line 44

Fatal error: Maximum execution time of 30 seconds exceeded in c:\wamp\www\emailer\emailer.php on line 45


I use the txt file to import email address.

php code :-
Expand|Select|Wrap|Line Numbers
  1. <? ob_start();
  2.  
  3. include("config.php");
  4.  
  5. $subject = $_POST["subject"];
  6.  
  7. $message = $_POST["body1"];
  8.  
  9. $headers = "From: ".$_POST["sender_mail"]."\r\n" .
  10.    "Reply-To: ".$_POST["sender_mail"] . "\r\n" .
  11. $headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
  12.  
  13. if($readfrom=="database"){
  14.  
  15.     if(!$_GET["end"]){
  16.         $end=0;
  17.     }
  18.  
  19.     $query=mysql_query("SELECT $column from $table LIMIT $end,100 ;");
  20.  
  21.     if(mysql_affected_rows()==0){
  22.         echo "Operation Finished";
  23.         exit();
  24.     }
  25.  
  26.  
  27.     while($data=mysql_fetch_array($query)){
  28.         $email=$data[$column];
  29.         mail($email, $subject, $message, $headers);
  30.         //echo $email."<br>";
  31.     }
  32.  
  33. }
  34.  
  35.  
  36.  
  37. elseif($readfrom=="file"){
  38.     $handle = @fopen($filepath, "r");
  39.     if ($handle) {
  40.            while (!feof($handle)) {
  41.                    $email = fgets($handle);
  42.                    mail($email, $subject, $message, $headers);
  43.                 $email."<br>";
  44.            }
  45.            fclose($handle);
  46.     }
  47. }
  48.  
  49. if($readfrom=="database"){
  50.     $end+=$qty;
  51.     echo "<META HTTP-EQUIV=\"refresh\" 
  52.     CONTENT=\"1;URL=http://$domain/emailer.php?end=$end\">";
  53. }
  54. header("location:sendmail.php");
  55. ?>
Oct 12 '07 #1
2 1840
pbmods
5,821 Expert 4TB
Heya, Vinod. Welcome (back) to TSDN!

Changed thread title to better describe the problem (did you know that threads whose titles do not follow the Posting Guidelines actually get FEWER responses?).

Please use CODE tags when posting source code:

[CODE=php]
PHP code goes here.
[/CODE]
Oct 12 '07 #2
ak1dnar
1,584 Expert 1GB
Php mail() funtion is a vary basic way to send web based mails. from your error message itself you can find out the reason for not sending your mails to all your recipients. fsockopen() with RCPT might be able to handle the load,
or else google for "mass email with php" you can find a solution. there are applications to handle this.
Oct 13 '07 #3

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

Similar topics

17
by: Phil Powell | last post by:
Where can I find an online PHP form validator script library to use? I have tried hacking the one here at work for weeks now and it's getting more and more impossible to customize, especially now...
9
by: mcp6453 | last post by:
I'm posting in desperation and hopes that someone has a script that will achieve these objectives: 1. Web interface using forms collects Name, Address, Email Address. 2. Web interface sends this...
8
by: Good Man | last post by:
Hi I'm building a 'job posting' site of sorts. When a job is available in a particular state, I want the system to send an email to everyone who is 'watching' that state. I know how to do...
16
by: Fox | last post by:
I merged and modified these script which work perfectly fine as long as I use server.execute to access the VBS part (which is itself in another ASP file). When these I use a session variable to...
1
by: Keith Sauvant | last post by:
Hi! Strange problem on a lamp installation: A script runs longer than 5 minutes and sends no output to the browser until it is finished. When called at customer site it gets stopped after...
6
by: carmen | last post by:
Hello I came across a php script on the net that will compare a web surfers IP address to those in a text file. If a match or partial match is found, the user is banned from accessing the php...
5
by: Cleverbum | last post by:
I'm not really accustomed to string manipulation and so I was wondering if any of you could be any help i speeding up this script intended to change the format of some saved log information into a...
4
by: thomasg | last post by:
Hi, I have 42,000 emails address of registered users in our company database. We would like to send out bulk emails to those users. Can anyone suggest a free PHP bulk emails script? Thanks
5
by: ozzii | last post by:
Hi, I have a asp email script which uses cdosys to send emails with attahcments by iterating through a record set of 500 email addresses. However the script simply times out. I know you can...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.