Mailbox update
This commit is contained in:
@@ -3,10 +3,12 @@ require 'renderer.php';
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
class Emailinbox extends Renderer {
|
||||
private string $folder = 'INBOX';
|
||||
|
||||
public function __construct(?string $templateName = null) {
|
||||
parent::__construct();
|
||||
if (!$this->connectToImap()) {
|
||||
$folder = $filter_input(INPUT_GET, 'folder') ?? 'INBOX';
|
||||
if (!$this->connectToImap($folder)) {
|
||||
$this->templateName = 'imaperror';
|
||||
}
|
||||
}
|
||||
@@ -68,6 +70,5 @@ class Emailinbox extends Renderer {
|
||||
$folderItems[] = '<li><a href="/emailinbox?folder=' . urlencode($folder['shortpath']) . '">' . utf8_encode($folder['shortpath']) . '</a></li>';
|
||||
}
|
||||
$this->content['folders'] = implode('', $folderItems);
|
||||
// var_dump($folders);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,9 +451,9 @@ class Renderer {
|
||||
$mail->send();
|
||||
}
|
||||
|
||||
protected function connectToImap(): bool {
|
||||
protected function connectToImap($folder = ''): bool {
|
||||
$this->mbox = new PhpImap\Mailbox(
|
||||
'{' . $this->imapServer . ':' . $this->imapPort . '/imap/ssl}',
|
||||
'{' . $this->imapServer . ':' . $this->imapPort . '/imap/ssl}' . $folder,
|
||||
$this->emailUser,
|
||||
$this->emailPassword,
|
||||
__DIR__,
|
||||
@@ -466,11 +466,6 @@ class Renderer {
|
||||
3,
|
||||
[]
|
||||
);
|
||||
/* $this->mbox = imap_open ("{" . $this->imapServer . ":" . $this->imapPort . "/imap/ssl}INBOX", $this->emailUser, $this->emailPassword);
|
||||
if ($this->mbox === false) {
|
||||
$errors = imap_errors();
|
||||
$this->errors = is_array($errors) ? $errors : [$errors];
|
||||
}*/
|
||||
return ($this->mbox !== false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user