SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Evangelist achintya's Avatar
    Join Date
    Apr 2005
    Location
    Chandannagar(India)
    Posts
    459
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Question 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.

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    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.

  3. #3
    SitePoint Enthusiast
    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); 
    Then add checkpoint array at the points you want to measure:

    PHP Code:
    $checkpoint[0] = microtime(1);
    $checkpoint[1] = microtime(1);
    // etc. 
    Then at the end show how long they took:

    PHP Code:
    foreach ($checkpoint as $k => $v)
    {
        
    $time_elapsed $v $time_start
        echo 
    "Checkpoint {$k} reached in {$time_elapsed} seconds <br>"


  4. #4
    SitePoint Evangelist achintya's Avatar
    Join Date
    Apr 2005
    Location
    Chandannagar(India)
    Posts
    459
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Many thanks guys. I appreciate your suggestions. Also I have implemented some of them and my page loading time has decreased. I also thanks SitePoint Website owners for giving us such a platform for knowledge sharing. Thanks again SilverBulletUK and STeeL_LT.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •