This commit is contained in:
Torsten Schulz
2023-06-16 11:57:49 +02:00
commit 44da93c0e9
328 changed files with 134580 additions and 0 deletions

34
include/mail.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
require 'vendor/autoload.php';
require 'mailhandling.php';
class Mail extends Mailhandling {
// protected $mbox = null;
protected $uid = 0;
public function __construct(?string $templateName = null) {
parent::__construct();
if (!$this->connectToImap()) {
$this->templateName = 'imaperror';
return;
}
$this->uid = $this->getUriParams()['uid'];
$this->content['uid'] = $this->uid;
}
protected function generateContent(): void {
$messageStructure = imap_fetchstructure($this->mbox, $this->uid);
$this->fetchEmailHeader($this->content);
$this->fetchEmailBody($messageStructure, $this->content, 'INBOX', FT_PEEK);
$this->renderAttachments($messageStructure);
}
protected function renderAttachments($messageStructure): void {
$attachments = $this->getAttachments($messageStructure);
$contentArray = [];
foreach ($attachments as $attachment) {
$contentArray[] = $attachment['filename'];
}
$this->content['attachments'] = implode('<br>', $contentArray);
}
}