WIP - New imap class

This commit is contained in:
Torsten Schulz
2023-10-16 15:41:05 +02:00
parent 54d30dd3c3
commit 6a9717e0db
165 changed files with 7347 additions and 10527 deletions

View File

@@ -2,7 +2,8 @@
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
use PhpImap\Mailbox;
use Webklex\PHPIMAP\ClientManager;
use Webklex\PHPIMAP\Client;
require 'vendor/autoload.php';
@@ -34,7 +35,8 @@ class Renderer {
protected int $smtpPort = 465;
protected string $emailUser = 'foerderverein-ajs@gmx.de';
protected string $emailPassword = 'HarheimerWeg16';
protected $mbox;
protected ClientManager $imapClientManager;
protected Client $mbox;
public function __construct(?string $templateName = null) {
session_start();
@@ -452,21 +454,18 @@ class Renderer {
}
protected function connectToImap($folder = ''): bool {
$this->mbox = new PhpImap\Mailbox(
'{' . $this->imapServer . ':' . $this->imapPort . '/imap/ssl}' . imap_utf7_encode($folder),
$this->emailUser,
$this->emailPassword,
__DIR__,
'UTF-8',
true,
false
);
$this->mbox->setConnectionArgs(
CL_EXPUNGE,
3,
[]
);
return ($this->mbox !== false);
$this->imapClientManager = new ClientManager('conf/imap.php');
$this->mbox = $this->imapClientManager->make([
'host' => $this->imapServer,
'port' => $this->imapPort,
'encryption' => 'ssl',
'validate_cert' => true,
'username' => $this->emailUser,
'password' => $this->emailPassword,
'protocol' => 'imap'
]);
$this->mbox->connect();
return $this->mbox->isConnected();;
}
protected function saveFileLocal(string $newFileName, string $content, string $salt): void {