Monkuar Posted November 12, 2012 Share Posted November 12, 2012 hey guys, quick question whenever I sent a simple email message it takes the server about an extra 1-3 seconds mostly just 1.25ms but the problem is i have a redirection feature, so if someone send's someone a Message, it redirects them (a simple redirect page) so the code looks like this: blahblahcode insert into message redirect user to messenger page send mail function the problem is, if I put the sendmail function above the redirect, it lags for like 1-2 seconds to send the mail and the redirection is not instant. (feels like the site is lagging) how do I go about, sending that email after I click redirection so that's instant, but the mail processes after redirection instead? Quote Link to comment https://forums.phpfreaks.com/topic/270587-php-mail-lag/ Share on other sites More sharing options...
Muddy_Funster Posted November 12, 2012 Share Posted November 12, 2012 you could redirect to a page with a hidden div / iframe that you use to run the mail script. this should keep the ui flow smooth and let the mail be processed "in the background" so to speek. Only problem would be if the page they end up on is closed or navigated away from before the sendmail is completed, then it may not send at all. Quote Link to comment https://forums.phpfreaks.com/topic/270587-php-mail-lag/#findComment-1391794 Share on other sites More sharing options...
Monkuar Posted November 13, 2012 Author Share Posted November 13, 2012 you could redirect to a page with a hidden div / iframe that you use to run the mail script. this should keep the ui flow smooth and let the mail be processed "in the background" so to speek. Only problem would be if the page they end up on is closed or navigated away from before the sendmail is completed, then it may not send at all. This is a good idea, any others? ( I can set a spam session on that page to, use the same session to store how many seconds per message) so they cannot be spammed. (Or if they get even more dirty just use the db) Quote Link to comment https://forums.phpfreaks.com/topic/270587-php-mail-lag/#findComment-1392156 Share on other sites More sharing options...
jazzman1 Posted November 14, 2012 Share Posted November 14, 2012 (edited) You can use a cron ob to send the php scrips like a demon. In the same way I've sent about 2000 mails to my subscribers in 30 min delay.. Do you need to give you an example about this ? Edited November 14, 2012 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/270587-php-mail-lag/#findComment-1392160 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.