POP3::connect()publicWP 1.0

Метод класса: POP3{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$POP3 = new POP3();
$POP3->connect ( $server, $port );
$server (обязательный)
-
$port **
-
По умолчанию: 110

Код POP3::connect() WP 6.4.3

function connect ($server, $port = 110)  {
    //  Opens a socket to the specified server. Unless overridden,
    //  port defaults to 110. Returns true on success, false on fail

    // If MAILSERVER is set, override $server with its value.

if (!isset($port) || !$port) {$port = 110;}
    if(!empty($this->MAILSERVER))
        $server = $this->MAILSERVER;

    if(empty($server)){
        $this->ERROR = "POP3 connect: " . _("No server specified");
        unset($this->FP);
        return false;
    }

    $fp = @fsockopen("$server", $port, $errno, $errstr);

    if(!$fp) {
        $this->ERROR = "POP3 connect: " . _("Error ") . "[$errno] [$errstr]";
        unset($this->FP);
        return false;
    }

    socket_set_blocking($fp,-1);
    $this->update_timer();
    $reply = fgets($fp,$this->BUFFER);
    $reply = $this->strip_clf($reply);
    if($this->DEBUG)
        error_log("POP3 SEND [connect: $server] GOT [$reply]",0);
    if(!$this->is_ok($reply)) {
        $this->ERROR = "POP3 connect: " . _("Error ") . "[$reply]";
        unset($this->FP);
        return false;
    }
    $this->FP = $fp;
    $this->BANNER = $this->parse_banner($reply);
    return true;
}