Jump to content

Php Mail() Lag


Monkuar

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/270587-php-mail-lag/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/270587-php-mail-lag/#findComment-1391794
Share on other sites

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)

Link to comment
https://forums.phpfreaks.com/topic/270587-php-mail-lag/#findComment-1392156
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.