Icy Phoenix

     
 


Post new topic  Reply to topic 
Page 1 of 1
 
 
Reply with quote Download Post 
Post Problem With Mega Mail 
 
in our forum we have 16218 registered users and zero non-active members, so yesterday i sent a megamail to all-users but the script finished sending with no errors @ 15829    any idea? i noticed that every time mega mail doesn't really send to all users
thank you in advance
 




____________
rescued by MG :10k_0025:
 
ieioSend private message  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post Re: Problem With Mega Mail 
 
Interesting question, though I dont' know the answer, it makes me wonder if users have the option to 'not be contacted by email' on your site, including admin.

Sorry if this doesn't help, but it's an option that some sites include. And I'm not sure if Icy does.
 



 
feticheSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Problem With Mega Mail 
 
In my forum have more of 8500 users registers and 880 no actives,   and contact for megamail at 4800
 




____________
? JHOSMAN - Webmaster
 
JHOSMANSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Problem With Mega Mail 
 
no one has the same problem?
 




____________
rescued by MG :10k_0025:
 
ieioSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Problem With Mega Mail 
 
banned members?
 




____________
? Zuker - EDDB - LPM - Sharefields
 
ZukerSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Problem With Mega Mail 
 
Zuker wrote: [View Post]
banned members?


banned is 2 members  
 




____________
? JHOSMAN - Webmaster
 
JHOSMANSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Problem With Mega Mail 
 
Zuker wrote: [View Post]
banned members?
not in my case: I have less than 20 banned users  
 




____________
rescued by MG :10k_0025:
 
ieioSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Problem With Mega Mail 
 
I think with so many emails, maybe the script is timing out?

There is a code at the top of admin_megamail.php which tries to increase time limit:

Code: [Download] [Hide] [Select]
@set_time_limit(1200);


However this is not very well conceived for two reasons. Firstly, 1200s is pointless, because apache server has a default timeout of 300s.
Secondly, there should be some checking. set_time_limit does not work if safe mode is on.

It should have something like:
Code: [Download] [Hide] [Select]
if( !ini_get('safe_mode') )// No point doing this if safe mode is on, set_time_limit never works.
{                                                        
        set_time_limit(300);
}


However, even if safe mode is OFF, the host might not allow set_time_limit to be modified - I've found when they do this, that trying to use set_time_limit actually causes the scripts to terminate earlier than if I just used the default setting of the server... So my advice would be to try and comment out the set time limit lines, in case that could be happening. Otherwise...

The best remedy would require a bit of re-writing of the script, so that it stored an array of users to send emails to in a $_SESSION array, and you just clicked a button send "next batch" until the $_SESSION array was cleared (each script execution removes a group of usernames from the array once their emails are sent). Handling it in a $_SESSION array is the simplest way I can see to handle multiple page loads.
 



 
moreteavicarSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Problem With Mega Mail 
 
And... of course, if its your very own server, you can edit the apache config to increase the default page execution time...
 



 
moreteavicarSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Problem With Mega Mail 
 
moreteavicar, forgive me if i didn't reply sooner but i was investigating the causes of my problem; i'm on a shared server so i can't manage with php settings   but i had an idea   is there a simply way to create a group from the first (for example) 10000 registered users? in this way i can split megamail in any part I need
 




____________
rescued by MG :10k_0025:
 
ieioSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Problem With Mega Mail 
 
Hile... no problem I forgot all about this. Yes, as per my 2nd from last post - the easiest way would be to put all the user_ids from DB into an array, stored as a $_SESSION variable, e.g. $_SESSION['user'][$i] (extracting all the ids from SQL is the quickest part - I mean, extracting 20,000 rows should take less than 0.5s on your average server - as you know, it is the emailing that causes problems). You can then let the script execute for the first N elements of the array (e.g. N=10,000) - whilst doing this, remove the first N elements, so that the next time round, the script can send emails for the remainder user_ids. I'll have a think about this perhaps - its not hard to write, just finding the time...
 



 
moreteavicarSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Problem With Mega Mail 
 
I just checked the rest of the code in megamail, and already there is message sessions - you just set the number of posts in a single send with BATCH SIZE.

The way it is implemented is not good though - it is still dependent upon a single execution of the script, where you get floored by the server script time limit, rather than allowing you to hit a button like "continue" or "send next N emails"... so theres still something I can look at...

I am a fool!   I overlooked this line:

Code: [Download] [Hide] [Select]
$template->assign_vars(array(
                'META' => '<meta http-equiv="refresh" content="'.$mail_data['batch_wait'].';url=' . $url . '">'
                )


The script should auto-refresh for every BATCH SIZE number of email addresses sent. You should keep BATCH SIZE small-ish, around 100 or so, and batch time - maybe this can be 5s (default is 10s). With this auto-refresh system, there is no need to worry about script execution time since it should refresh every 10 seconds, dumping the next 100 messages etc... (as said earlier, comment out / remove the script execution time statement would be better, because it could actually compromise the execution of the script). Of course, this means you go away and leave it refreshing itself 160 times (16,000 users / 100) which will take 160 x 10s = 1600s or 27 mins

When megamail sends the emails, it puts all the list of senders into the bcc field as one long string, so with BATCH SIZE = 100, that is 100 email addresses in the BCC field. If you've put in BATCH SIZE = 10,000, then it tries to send an email with a bcc list containing 10,000 email addresses! There could be limits on how big the bcc field list might be, but you also need to give the mail server enough time to execute and send to all the recipients on the bcc, so the default values are probably best used.

Sorry, since I've never had so many users, I've never known about megamail before  
 



 
Edited by moreteavicar, Wed 23 Apr, 2008 14:06: Damnation! I screwed up bit time! Get me outta here!
moreteavicarSend private message  
Back to topPage bottom
Post new topic  Reply to topic  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events


  

 

  cron