The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Mail piping problem with PHP script - Help please

Discussion in 'E-mail Discussions' started by Mar, Apr 7, 2004.

  1. Mar

    Mar Member

    Joined:
    Mar 23, 2003
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Warning: imap_open(): Couldn't open stream {mail.XXXX.com/pop3:110}INBOX in /home/xxxx/public_html/helpdesk/receive.php on line 161

    I'm a newbie to this and my helpdesk script's causing this problem on my cPanel hosting account; the code reads -

    $query = "SELECT * FROM mail_accounts";
    $mail_accounts = mysql_query($query);
    while ($mails = mysql_fetch_array($mail_accounts))
    {
    $receive_server = $mail_servers[$mails["ms_id"]];
    $r_login = $mails["login"];
    $r_password = $mails["passwd"];
    if ($mail_servers_type[$mails["ms_id"]] == "p") $receive_server .= "/pop3:110";
    else $receive_server .= ":143";

    if ($mbox = imap_open("\{$receive_server}INBOX", $r_login, $r_password))

    I really need to get this sorted for cPanel hosting , so if anyone is able to help, I'd really appreciate it.

    Thanks
    Mar
     
  2. Mar

    Mar Member

    Joined:
    Mar 23, 2003
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    is there anything specific I should be asking my host about compiling IMAP on the server to make this script work? .... what I know about an IMAP program could be written on a postage stamp - and currently probably should!

    The script used to work ok - and then one night it just stopped receiving tickets. Since then, I can only make it work on hosting of the DirectAdmin/Ensim flavor .

    Thanks
    M
     
  3. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Firstly, I'm not a PHP programmer (I only do perl) but:

    1. This is not a piping problem, because the script is logging into the POP3 account and retrieving email, it is not being sent from the MTA directly to the script (which is piping)

    2. I may be wrong, but I believe that the method being used in the script probably uses PHP sockets() which are not built by default into PHP. So my guess would be that you need PHP recompiled with sockets() support enabled.

    I could easily be completely wrong, though.
     
  4. Mar

    Mar Member

    Joined:
    Mar 23, 2003
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    OK, thanks - I'm away to try that and see if it helps :)

    will let you know.

    M
     
  5. Host4u2

    Host4u2 Well-Known Member

    Joined:
    Mar 24, 2002
    Messages:
    248
    Likes Received:
    0
    Trophy Points:
    16
    According to your php.info, sockets are already enabled:

    Configure Command:

    './configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-xml' '--enable-bcmath' '--enable-calendar' '--with-curl' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr' '--with-xpm-dir=/usr/X11R6' '--with-imap' '--with-imap-ssl' '--with-kerberos' '--with-mcrypt' '--enable-magic-quotes' '--with-mysql' '--with-pear' '--enable-sockets' '--enable-track-vars' '--enable-versioning' '--with-xmlrpc' '--with-zlib'
     
  6. Mar

    Mar Member

    Joined:
    Mar 23, 2003
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    It would've been nice ...

    sockets support is ok, so that's another line of thought crossed off the list of possibilities. -

    I'm open to suggestions if anyone can see the problem!

    Thanks for all comments in the meantime.

    Mar
     
  7. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Ah well, i tried :(

    How about this, then: if your POP3 access is on the same server as your web access, you can try changing mail.XXXX.com (where ever you enter that) to the single word:

    localhost

    If that doesn't work, you might need to monitor the /var/log/maillog file while running the script to see if a POP3 error is generated at the same time.

    You should also check that the server is not blocking (via a firewall) *outbound* connections on port 110.
     
  8. Mar

    Mar Member

    Joined:
    Mar 23, 2003
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Thanks - I'll try that and see if we get anywhere further.

    Mar
     
  9. Mar

    Mar Member

    Joined:
    Mar 23, 2003
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Localhost

    was a great answer! Many thanks for all your help.

    Mar
     
  10. CoolMike

    CoolMike Well-Known Member

    Joined:
    Sep 6, 2001
    Messages:
    307
    Likes Received:
    0
    Trophy Points:
    16
    Does it work now? Because we have exactly the same problem, what was the solution?

    Thanks
    Mike
     
  11. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    The answer is to change the domain to the single word localhost

    When this fixes a problem, it's usually down to a local DNS misconfiguration.
     
  12. CoolMike

    CoolMike Well-Known Member

    Joined:
    Sep 6, 2001
    Messages:
    307
    Likes Received:
    0
    Trophy Points:
    16
    Hmm, in this case I have another problem:

    Code:
    $mbox = imap_open ("{localhost:143}INBOX", "user@domain.com", "password"); 
    
    The output is just blanks and hangs, and in lynx I can read something about Network error.

    Any other ideas?

    Thanks
    Mike
     
  13. Host4u2

    Host4u2 Well-Known Member

    Joined:
    Mar 24, 2002
    Messages:
    248
    Likes Received:
    0
    Trophy Points:
    16
    Ths issue was originally posted regarding sending mail via a helpdesk php script, and using localhost worked in the script where calling "/pop3:110" did not. There was/is no dns misconfiguration :)
     
Loading...

Share This Page