Pegasus Mail & Mercury

Welcome to the Community for Pegasus Mail and
The Mercury Mail Transport System, the Internet's longest-serving PC e-mail system!
Welcome to Pegasus Mail & Mercury Sign in | Join | Help
in
Home Blogs Forums Downloads Pegasus Mail Overview Mercury Overview Wiki

PHP time out waiting for response from Mercury

Last post 02-10-2010, 23:44 by Peter Strömblad. 6 replies.
Sort Posts: Previous Next
  •  01-30-2010, 2:01

    • Danievdw is not online. Last active: 01-30-2010, 17:03 Danievdw
    • Not Ranked
    • Joined on 01-30-2010
    • Member
    • Points 65

    PHP time out waiting for response from Mercury

    Hi

     I have been setting up a web page, WWW and mail server using the Xampp package. So far I have been able to overcome all my inexperience with the help of guides and what not, but have walked in to something I dont find any answer to.

    My one PHP script requires e-mail verification, and I use PHPmailer through Mercury for that. I set up Mercury to use my Gmail, and everything works just fine, except for a communication gap between Mercury and PHPmailer.

    I submit registration details and after a while I get :

     

    Warning: fsockopen() [function.fsockopen]: unable to connect to :25 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ) in C:\Inetpub\PhP and Sql\xampp\htdocs\class.smtp.php on line 122

     

    1. I changed the time-out in the PHPscript to 60 seconds even, but no luck.

    2. The process completes successfully though, and I get my mail in Gmail without any problems.

     T 20100130 024535 4b639d11 Connection from 127.0.0.1
    T 20100130 024535 4b639d11 HELO danie
    T 20100130 024535 4b639d11 MAIL FROM:<postmaster@localhost>
    T 20100130 024535 4b639d11 RCPT TO:<7fatcowsinfo@gmail.com>
    T 20100130 024535 4b639d11 DATA
    T 20100130 024535 4b639d11 DATA - 29 lines, 661 bytes.
    T 20100130 024535 4b639d11 QUIT
    T 20100130 024535 4b639d11 Connection closed with 127.0.0.1, 0 sec. elapsed.
     

    Is there some setting in Mercury that I need to set in order for it to acknowledge to the script that the process was successful ? Or am I missing something else completely ? 

  •  01-30-2010, 2:11

    Re: PHP time out waiting for response from Mercury

    That MercS log is completely normal and completes normally Smile, in under one second.

    I have no idea what your script may be waiting for.

    Turn on session logging for MercS to get a complete transcript that may provide more clues.

  •  01-30-2010, 2:25

    • Danievdw is not online. Last active: 01-30-2010, 17:03 Danievdw
    • Not Ranked
    • Joined on 01-30-2010
    • Member
    • Points 65

    Re: PHP time out waiting for response from Mercury

    As requested :

     

    03:18:25.343: Connection from 127.0.0.1, Sat Jan 30 03:18:25 2010<lf>
    03:18:25.343: << 220-SMTP ESMTP server ready.<cr><lf>220-220-somehost.somedomain.com Mercury/32 v3.21 ESMTP server ready.<cr><lf>220-220-Use of this server for unauthorised relaying of mail is forbidden.<cr><lf>220 220 Unsolicited Commercial E-mail ("spam") is NOT WELCOME HERE.<cr><lf>
    03:18:25.343: >> HELO danie<cr><lf>
    03:18:25.343: << 250 SMTP Hello, danie.<cr><lf>
    03:18:25.343: >> MAIL FROM:<postmaster@localhost><cr><lf>
    03:18:25.343: << 250 Sender OK - send RCPTs.<cr><lf>
    03:18:25.343: >> RCPT TO:<7fatcowsinfo@gmail.com><cr><lf>
    03:18:25.343: << 250 Recipient OK - send RCPT or DATA.<cr><lf>
    03:18:25.359: >> DATA<cr><lf>
    03:18:25.359: << 354 OK, send data, end with CRLF.CRLF<cr><lf>
    03:18:25.359: >> Date: Sat, 30 Jan 2010 03:18:25 +0200<cr><lf>
    03:18:25.359: >> Subject: Login Details<cr><lf>
    03:18:25.359: >> To: 7fatcowsinfo@gmail.com<cr><lf>
    03:18:25.359: >> From: "Member Registration" <auto-reply@7fatcowsmobile.mooo.com><cr><lf>
    03:18:25.359: >> X-Mailer: PHP/5.3.1<cr><lf>
    03:18:25.359: >> <cr><lf>
    03:18:25.359: >> Thank you for registering with us. Here are your login details...<lf>
    03:18:25.359: >> <cr><lf>
    03:18:25.359: >> <cr><lf>
    03:18:25.359: >> User ID: l<cr><lf>
    03:18:25.359: >> Email: 7fatcowsinfo@gmail.com <lf>
    03:18:25.359: >>  <cr><lf>
    03:18:25.359: >> Passwd:  <lf>
    03:18:25.359: >> <cr><lf>
    03:18:25.359: >> Activation code: 3354 <lf>
    03:18:25.359: >> <cr><lf>
    03:18:25.359: >> <cr><lf>
    03:18:25.359: >> *****ACTIVATION LINK*****<lf>
    03:18:25.359: >> <cr><lf>
    03:18:25.359: >> http://7fatcowsmobile.mooo.com/activate.php?user=32bb90e8976aab5298d5da10fe66f21d&activ_code=3354<cr><lf>
    03:18:25.359: >> <cr><lf>
    03:18:25.359: >> Thank You<cr><lf>
    03:18:25.359: >> <cr><lf>
    03:18:25.359: >> Administrator<cr><lf>
    03:18:25.359: >> 7FATCOWSMOBILE.MOOO.COM<cr><lf>
    03:18:25.359: >> ______________________________________________________<cr><lf>
    03:18:25.359: >> THIS IS AN AUTOMATED RESPONSE. <cr><lf>
    03:18:25.359: >> ***DO NOT RESPOND TO THIS EMAIL****<cr><lf>
    03:18:25.359: >> <cr><lf>
    03:18:25.359: >> .<cr><lf>
    03:18:25.359: << 250 Data received OK.<cr><lf>
    03:18:25.359: >> QUIT<cr><lf>
    03:18:25.359: << 221 SMTP Service closing channel.<cr><lf>
    03:18:25.359: --- Connection closed normally at Sat Jan 30 03:18:25 2010. ---
    03:18:25.359:
     

  •  01-30-2010, 2:38

    • Danievdw is not online. Last active: 01-30-2010, 17:03 Danievdw
    • Not Ranked
    • Joined on 01-30-2010
    • Member
    • Points 65

    Re: PHP time out waiting for response from Mercury

    This is the section of the code referred to by the error message

     

        #connect to the smtp server
        $this->smtp_conn = fsockopen($host,    # the host of the server
                                     $port,    # the port to use
                                     $errno,   # error number if any
                                     $errstr,  # error message if any
                                     $tval);   # give up after ? secs  <-------- line 122
        # verify we connected properly
        if(empty($this->smtp_conn)) {
          $this->error = array("error" => "Failed to connect to server",
                               "errno" => $errno,
                               "errstr" => $errstr);
          if($this->do_debug >= 1) {
            echo "SMTP -> ERROR: " . $this->error["error"] .
                     ": $errstr ($errno)" . $this->CRLF;
          }
          return false;
        }
     

  •  01-30-2010, 2:51

    Re: PHP time out waiting for response from Mercury

    Again, perfectly normal.

    From a Mercury perspective there is no problem.

    Afraid I can't help with PHP.

     

  •  01-30-2010, 8:06

    • Danievdw is not online. Last active: 01-30-2010, 17:03 Danievdw
    • Not Ranked
    • Joined on 01-30-2010
    • Member
    • Points 65

    Re: PHP time out waiting for response from Mercury

    Ok, thank you anyway. Will post when I get the solution.
  •  02-10-2010, 23:44

    Re: PHP time out waiting for response from Mercury

    This is a common problem. You need to tell the socket stack not re-use the socket, f.ex. by setting the socket idle timout on your session to a very low value (like 1 second).

    This is what it looks like when coding C# in .NET

    MailMessage msgMail = new MailMessage(); 
    msgMail.To.Add("address"); 
    msgMail.Body = "test"; 
    SmtpClient Client = new SmtpClient(); /* uses settings from web.config */
    Client.ServicePoint.MaxIdleTime = 1; /* without this the connection is idle too long */
    Client.Send(msgMail); 
    msgMail.Dispose();
    

    Kind regards / Peter
View as RSS news feed in XML

Contact | Advertise | Host provider: PraktIT | Terms of Use | Privacy Statement
Copyright © 2007-2010 David Harris / Peter Strömblad. | Pegasus Mail Home Page