SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
-
Mar 25, 2009, 07:57 #1
- Join Date
- Apr 2005
- Location
- Chandannagar(India)
- Posts
- 459
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
PHPMailer email taking too much time
Dear all,
I am using PHPmailer for sending few emails in my page. Now this page is too much time(approximately 45-50 seconds) to redirect to another page after submission. My question is that is there any ways by which i can reduce the loading time of my page. Now as far as sql queries are concerned,they are simple queries like select * from table1 where field1='No' etc and all my tables are indexed. So i think my queries are optimized. Also currently my project is in testing mode and when go live ,i can expect 100-200 emails from page. So please help me in this matter.
-
Mar 25, 2009, 08:19 #2
- Join Date
- Apr 2008
- Location
- North-East, UK.
- Posts
- 6,111
- Mentioned
- 3 Post(s)
- Tagged
- 0 Thread(s)
I would guess PHPMailer is interfacing directly with the remote SMTP servers, so depending on their response times, that could be holding you up.
If you have cron capability, you could store the emails in your database and have a cron job process this 'queue', therefore imposing no wait time for your users.
@AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.
-
Mar 25, 2009, 08:20 #3
- Join Date
- May 2006
- Posts
- 75
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Try benchmarking your code to see where the delay is. At the beginning use:
PHP Code:$time_start = microtime(1);
PHP Code:$checkpoint[0] = microtime(1);
$checkpoint[1] = microtime(1);
// etc.
PHP Code:foreach ($checkpoint as $k => $v)
{
$time_elapsed = $v - $time_start;
echo "Checkpoint {$k} reached in {$time_elapsed} seconds <br>";
}
-
Mar 26, 2009, 00:56 #4
Bookmarks