public function connectDefault($mailbox, $username, $password, $encryption = null)
    {
        $connect = new ImapConnect();
        if($encryption === ImapClient::ENCRYPT_SSL){
            $connect->prepareFlags(ImapConnect::SERVICE_IMAP, ImapConnect::ENCRYPT_SSL, ImapConnect::NOVALIDATE_CERT);
        };
        if($encryption === ImapClient::ENCRYPT_TLS){
            $connect->prepareFlags(ImapConnect::SERVICE_IMAP, ImapConnect::ENCRYPT_TLS, ImapConnect::NOVALIDATE_CERT);
        };
        $connect->prepareMailbox($mailbox);
        $connect->connect(null, $username, $password);
        $this->imap = $connect->getImap();
        $this->mailbox = $connect->getMailbox();
    }
public function connectDefault($mailbox, $username, $password, $encryption = null)
    {
        $connect = new ImapConnect();
        if($encryption === ImapClient::ENCRYPT_SSL){
            $connect->prepareFlags(ImapConnect::SERVICE_IMAP, ImapConnect::ENCRYPT_SSL, ImapConnect::NOVALIDATE_CERT);
        };
        if($encryption === ImapClient::ENCRYPT_TLS){
            $connect->prepareFlags(ImapConnect::SERVICE_IMAP, ImapConnect::ENCRYPT_TLS, ImapConnect::NOVALIDATE_CERT);
        };
        $connect->prepareMailbox($mailbox);
        $connect->connect(null, $username, $password);
        $this->imap = $connect->getImap();
        $this->mailbox = $connect->getMailbox();
    }
public function connectDefault ( $ mailbox , $ username , $ password , $ encryption = null ) { $ connect = new ImapConnect ( ) ; if ( $ encryption === ImapClient :: ENCRYPT_SSL ) { $ connect -> prepareFlags ( ImapConnect :: SERVICE_IMAP , ImapConnect :: ENCRYPT_SSL , ImapConnect :: NOVALIDATE_CERT ) ; } ; if ( $ encryption === ImapClient :: ENCRYPT_TLS ) { $ connect -> prepareFlags ( ImapConnect :: SERVICE_IMAP , ImapConnect :: ENCRYPT_TLS , ImapConnect :: NOVALIDATE_CERT ) ; } ; $ connect -> prepareMailbox ( $ mailbox ) ; $ connect -> connect ( null , $ username , $ password ) ; $ this -> imap = $ connect -> getImap ( ) ; $ this -> mailbox = $ connect -> getMailbox ( ) ; }
The default connection.
Not used a lot of imap connection options.
Use only ENCRYPT_SSL and VALIDATE_CERT.

If you need a more advanced connection settings,
use connectAdvanced() method.

@param string $mailbox
@param string $username
@param string $password
@param string $encryption use ImapClient::ENCRYPT_SSL or ImapClient::ENCRYPT_TLS
@return void
The default connection . Not used a lot of imap connection options . Use only ENCRYPT_SSL and VALIDATE_CERT .