IMAP Command with PHP VivOAuthIMAP


IMAP Command with PHP VivOAuthIMAP

我正在使用以下库:https://github.com/vmuthal/VivOAuthIMAP

我想添加一个名为Search From的功能,使我能够搜索来自特定发件人的邮件。这是附加功能:

public function searchfrom($expeditor) {
    $this->writeCommannd("A" . $this->codeCounter, " UID SEARCH FROM '"".$expeditor."'" ");
    $response = $this->readResponse("A" . $this->codeCounter); 
    return $this->modifyResponse($response);
}

服务器的结果是:"BAD"(没有其他内容)。

   /**
    * Search in FROM ie. Email Address
    * @param string $email
    * @return Array
    */
    public function searchFrom($email) {
        $this->writeCommannd("A" . $this->codeCounter, "SEARCH FROM '"$email'"");
        $response = $this->readResponse("A" . $this->codeCounter);      
        //Fetch by ids got in response
        $ids = explode(" ", trim($response[0][1]));     
        unset($ids[0]);
        unset($ids[1]);     
        $ids = array_values($ids);
        $stringIds = implode(",",$ids);     
        $mails = $this->getMessage($stringIds);         
        return $mails;
    }

我已将此添加到库中。检查它是否适合你。https://github.com/vmuthal/VivOAuthIMAP/blob/master/src/VivOAuthIMAP.php