jozs2021
jozs2021

Reputation: 91

Why not connect PHP imap/pop3?

I'm sorry, I speak a little English.

Some days try, try and try. Read all stackoverflow questions and answers this, but no help.

I would like only one imap connection.

I try some webhost and not works.

Please help me.

// $foo = "{pop3.indamail.hu:110}"; // [CLOSED] IMAP connection broken (server response)
// $foo = "{pop3.indamail.hu:110/pop3}"; // Can not authenticate to POP3 server: POP3 connection broken in response
// $foo = "{imap.indamail.hu:143}"; // Can not authenticate to IMAP server: [CLOSED] IMAP connection broken (authenticate)
// $foo = "{imap.indamail.hu:143/imap}"; // Can not authenticate to IMAP server: [CLOSED] IMAP connection broken (authenticate)
// $foo = "{pop3.indamail.hu:110/pop3}INBOX"; // Can not authenticate to POP3 server: POP3 connection broken in response
// $foo = "{imap.indamail.hu:143/imap}INBOX"; // Can not authenticate to IMAP server: [CLOSED] IMAP connection broken (authenticate)
// $foo = "{imap.indamail.hu:143/imap/tls}INBOX"; // Unable to negotiate TLS with this server
// $foo = "{imap.indamail.hu:143/imap/notls}INBOX"; // Can not authenticate to IMAP server: [CLOSED] IMAP connection broken (authenticate)
// $foo = "{imap.indamail.hu:143/imap/novalidate-cert}INBOX"; // Can not authenticate to IMAP server: [CLOSED] IMAP connection broken (authenticate)
// $foo = "{imap.indamail.hu:993/imap}"; // [CLOSED] IMAP connection broken (server response)
// $foo = "{pop3.indamail.hu:995/pop3}"; // POP3 connection broken in response
// $foo = "{imap.indamail.hu:993/imap/ssl/novalidate-cert}"; // Can not authenticate to IMAP server: [CLOSED] IMAP connection broken (authenticate)
// $foo = "{pop3.indamail.hu:995/pop3/ssl/novalidate-cert}"; // Can not authenticate to POP3 server: POP3 connection broken in response
$mbox = imap_open ( $foo, "********@indamail.hu", "********" ) or die ( imap_last_error () );

The errors, please see the code.

I try, but ok-ok:

// $fp = fsockopen ( "imap.indamail.hu", 143, $errno, $errstr, 30 ); // ok
// $fp = fsockopen ( "imap.indamail.hu", 993, $errno, $errstr, 30 ); // ok
// $fp = fsockopen ( "pop3.indamail.hu", 110, $errno, $errstr, 30 ); // ok
// $fp = fsockopen ( "pop3.indamail.hu", 995, $errno, $errstr, 30 ); // ok

// $fp = fsockopen ( "imap.indamail.hu", 992, $errno, $errstr, 30 ); // Connection timed out (110)

if ( ! $fp ) {
    echo "$errstr ($errno)";
} else {
    echo "ok";
    fclose ( $fp );
}

Important! Only access countries: HU, SK, AT, RO, HR. My IP-address is HU/Hungary. I read the manual and I think only this ports: pop3:110 and imap:143.

Please help me.

Upvotes: 3

Views: 802

Answers (2)

O. Jones
O. Jones

Reputation: 108816

I think POP3 connection broken in response means a temporary connection failure.

Why do I think this?

Because I've been debugging a POP3 client program. After I hit the POP3 server at my hosting provider several times in succession, I think they lock me out. It's possible also that I try to take more than one concurrent exclusive-lock on my mailbox.

I think this message comes from within php-imap. I think it announces to the one calling imap_login() that the POP3 server stalled the tcp connection during authentication, then closed it abruptly. That's a reasonable DOS-attack countermeasure. I must have triggered it by mistake while debugging.

After a while everything starts working again.

This POP3 is an ancient protocol. RFC1939 says that it has just two status messages, +OK some random text and -ERR some other random text. So the content of those imap_errors() strings is whatever the programmer thought was helpful that day. Sigh.

Upvotes: 0

jozs2021
jozs2021

Reputation: 91

It works.

$e = '********@indamail.hu';
$s = '{imap.indamail.hu:143/authuser=' . $e . '}';
$mbox = imap_open ( $s, $e, '********' ) or die ( imap_last_error () );

No comment.

Upvotes: 0

Related Questions