php-imap icon indicating copy to clipboard operation
php-imap copied to clipboard

Error on connect to ssl

Open Aubin2319 opened this issue 2 years ago • 0 comments

Hi, here is my error return, I can't find why, then here is my code

`Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:0A00018A:SSL routines::dh key too small in /home/webadmin/web/test.assofl.fr/vendor/webklex/php-imap/src/Connection/Protocols/Protocol.php on line 204

Warning: stream_socket_client(): Failed to enable crypto in /home/webadmin/web/test.assofl.fr/vendor/webklex/php-imap/src/Connection/Protocols/Protocol.php on line 204

Warning: stream_socket_client(): Unable to connect to ssl://mail.aubin-holland.fr:993 (Unknown error) in /home/webadmin/web/test.assofl.fr/vendor/webklex/php-imap/src/Connection/Protocols/Protocol.php on line 204

Fatal error: Uncaught Webklex\PHPIMAP\Exceptions\ConnectionFailedException in /home/webadmin/web/test.assofl.fr/vendor/webklex/php-imap/src/Connection/Protocols/Protocol.php:208 Stack trace: #0 /home/webadmin/web/test.assofl.fr/vendor/webklex/php-imap/src/Connection/Protocols/ImapProtocol.php(80): Webklex\PHPIMAP\Connection\Protocols\Protocol->createStream() #1 /home/webadmin/web/test.assofl.fr/vendor/webklex/php-imap/src/Client.php(450): Webklex\PHPIMAP\Connection\Protocols\ImapProtocol->connect() #2 /home/webadmin/web/test.assofl.fr/maillist.php(15): Webklex\PHPIMAP\Client->connect() #3 {main} Next Webklex\PHPIMAP\Exceptions\ConnectionFailedException: connection failed in /home/webadmin/web/test.assofl.fr/vendor/webklex/php-imap/src/Connection/Protocols/ImapProtocol.php:88 Stack trace: #0 /home/webadmin/web/test.assofl.fr/vendor/webklex/php-imap/src/Client.php(450): Webklex\PHPIMAP\Connection\Protocols\ImapProtocol->connect() #1 /home/webadmin/web/test.assofl.fr/maillist.php(15): Webklex\PHPIMAP\Client->connect() #2 {main} thrown in /home/webadmin/web/test.assofl.fr/vendor/webklex/php-imap/src/Connection/Protocols/ImapProtocol.php on line 88`

My code :

`<?php

use Webklex\PHPIMAP\ClientManager; use Webklex\PHPIMAP\Client;

require_once "vendor/autoload.php";

$cm = new ClientManager('imap.php');

/** @var \Webklex\PHPIMAP\Client $client */ $client = $cm->account('default');

//Connect to the IMAP Server $client->connect();

//Get all Mailboxes /** @var \Webklex\PHPIMAP\Support\FolderCollection $folders */ $folders = $client->getFolders();

//Loop through every Mailbox /** @var \Webklex\PHPIMAP\Folder $folder */ foreach($folders as $folder){

//Get all Messages of the current Mailbox $folder
/** @var \Webklex\PHPIMAP\Support\MessageCollection $messages */
$messages = $folder->messages()->all()->get();

/** @var \Webklex\PHPIMAP\Message $message */
foreach($messages as $message){
    echo $message->getSubject().'<br />';
    echo 'Attachments: '.$message->getAttachments()->count().'<br />';
    echo $message->getHTMLBody();

    //Move the current Message to 'INBOX.read'
    if($message->move('INBOX.read') == true){
        echo 'Message has ben moved';
    }else{
        echo 'Message could not be moved';
    }
}

}

?>`

Thanks

Aubin2319 avatar Sep 27 '23 18:09 Aubin2319