clintxp Posted May 7, 2007 Share Posted May 7, 2007 I am trying to mass mail a newspaper with PHP mail. I am using a local SMTP server. I am trying to send 300 emails at one time (with a for loop i.e. sending the same email to the same recipient 300 times) but it only sends a few them, sometimes about 100, sometimes about 130 and so on.. Then the php script stops, it doesn't even gives me an error. I tried several different SMTP servers. I tried the same script on a domain and it worked perfectly. I don't think that the problem is coming from the SMTP server as the script is not sending the 300 emails, it is stopping. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/50335-php-mail-stopping-after-a-few-emails/ Share on other sites More sharing options...
mmarif4u Posted May 7, 2007 Share Posted May 7, 2007 R u getting the emails from mysql. Bcoz the php execution time is 60 sec(i think i am right). After that the code stop to work so may be this is the problem. Quote Link to comment https://forums.phpfreaks.com/topic/50335-php-mail-stopping-after-a-few-emails/#findComment-247135 Share on other sites More sharing options...
jitesh Posted May 7, 2007 Share Posted May 7, 2007 Do not rorate loop for email sent. Just merge all emails like this. // multiple recipients // $to = "a@a.com,b@a.com,c@a.com"; $to = 'aidan@example.com' . ', '; // note the comma $to .= 'wez@example.com'; Quote Link to comment https://forums.phpfreaks.com/topic/50335-php-mail-stopping-after-a-few-emails/#findComment-247136 Share on other sites More sharing options...
mmarif4u Posted May 7, 2007 Share Posted May 7, 2007 How can he put all emails on the page, i think its around 300 and may be increasing when new user sign up. the best way to do it is paginate ur script to multiple pages. Like in one page 50 records.then send the email to that 50 users then go to nest page send and so on... i am not sure about this but its simple way. Quote Link to comment https://forums.phpfreaks.com/topic/50335-php-mail-stopping-after-a-few-emails/#findComment-247138 Share on other sites More sharing options...
igor berger Posted May 7, 2007 Share Posted May 7, 2007 PHP has a function to turn off limit execution time, just set that in the beginning of your script! Now your server hosting people maybe disabled the mod! Find the function at php.net If you still having problem after setting up this function you may need to set up a counter to insert to mysql record to keep track of executions! You need to do this because the browser times itself out! Set the counter in the loop! Merging emails is not advised, because all email addresses will show up in an email! I would not like to have my email address to show in other people's email! If you have to do it send to list_or_what_ever@mydomain.com and Bcc: your audience! Another problem may be, that the loop works and does not time out, but you have a bad email address in a list that kills the rest of the run! Debugging is fun! Quote Link to comment https://forums.phpfreaks.com/topic/50335-php-mail-stopping-after-a-few-emails/#findComment-247143 Share on other sites More sharing options...
igor berger Posted May 7, 2007 Share Posted May 7, 2007 If anyone has a PHP SMTP email script that I can use on a virtual host please PM me! I do not have access to server root, only to home. I do not have access to php.ini or apachi .config I have access to .htaccess, PHP, MySql Can use some help, because using PHP mail() as send mail routine for lists is no good. And I have being using mail lists mailers that do not look professional. I looked at sourceforge mailer but you need access to php.ini if I am not wrong! There is another one called Zend, but not sure it will work on virtual host. Any advise? Quote Link to comment https://forums.phpfreaks.com/topic/50335-php-mail-stopping-after-a-few-emails/#findComment-247148 Share on other sites More sharing options...
clintxp Posted May 7, 2007 Author Share Posted May 7, 2007 thanks for all your fast replies As mmarif4u said, I editted the maximum execution time in php.ini and worked perfectly (was set to 30secs before!) thanks all of you! Quote Link to comment https://forums.phpfreaks.com/topic/50335-php-mail-stopping-after-a-few-emails/#findComment-247152 Share on other sites More sharing options...
igor berger Posted May 7, 2007 Share Posted May 7, 2007 Actually I do not recommend using PHP send mail for lists, because many email server will see it as Spam! So are you using a real SMPT mail() in PHP or PHP send mail mail()? I have a PhpBB forum installed on my server and it uses SMPT mailer. I need to extract the routine form PhpBB, but I have to much work to bother with it! This script has no problem sending to 7000 users! So again, if anyone has PHP SMTP mail script for virtual host please share it with us newbies! HA, ha!!! You lucky devil, access to php.ini Quote Link to comment https://forums.phpfreaks.com/topic/50335-php-mail-stopping-after-a-few-emails/#findComment-247153 Share on other sites More sharing options...
jitesh Posted May 7, 2007 Share Posted May 7, 2007 Attached is library to send SMTP mails. Review its readme file. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/50335-php-mail-stopping-after-a-few-emails/#findComment-247161 Share on other sites More sharing options...
igor berger Posted May 7, 2007 Share Posted May 7, 2007 This is a sourceforge PHP mailer. I am on a virtual host and do not have access to php.ini Installation: Copy class.phpmailer.php into your php.ini include path. If you are using the SMTP mailer then place class.smtp.php in your path as well. In the language directory you will find several files like phpmailer. But I can run php files from my home dir which is in php.ini include_path So by just copying the files to any of my dir is it okay? Do I need to configure the php.ini ? Or just copy the files to a dir home or above and use require("class.phpmailer.php") Sorry for asking this, because I can probably upload it and test it! But has anyone installed it on a virtual host? Thanx Quote Link to comment https://forums.phpfreaks.com/topic/50335-php-mail-stopping-after-a-few-emails/#findComment-247173 Share on other sites More sharing options...
jitesh Posted May 7, 2007 Share Posted May 7, 2007 But I can run php files from my home dir which is in php.ini include_path So by just copying the files to any of my dir is it okay YES Do I need to configure the php.ini ? NO . No need to do anything. just check your smtp host,smtp username and passwords are correct. just copy the example shown in readme file. and change values. Quote Link to comment https://forums.phpfreaks.com/topic/50335-php-mail-stopping-after-a-few-emails/#findComment-247188 Share on other sites More sharing options...
igor berger Posted May 7, 2007 Share Posted May 7, 2007 Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/50335-php-mail-stopping-after-a-few-emails/#findComment-247365 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.