Overworked mailbox
This commit is contained in:
@@ -20,19 +20,21 @@ class Mail extends Mailhandling {
|
||||
}
|
||||
|
||||
protected function generateContent(): void {
|
||||
$this->mail = $this->fetchEmail();
|
||||
$textHtml = $this->mail->textHtml;
|
||||
$textPlain = $this->mail->textPlain;
|
||||
$this->content['sender'] = $this->mail->headers->senderaddress;
|
||||
$this->content['receiver'] = $this->mail->headers->toaddress;
|
||||
$this->content['senddate'] = (new DateTime($this->mail->date))->format('d.m.Y');
|
||||
$this->content['emailbody'] = $this->mail->textHtml ?? $this->mail->textPlain;
|
||||
$this->content['subject'] = $this->mail->subject;
|
||||
$this->renderAttachments();
|
||||
$folder = $this->mbox->getFolderByName($this->folder);
|
||||
$message = $folder->query()->getMessageByUid($this->uid);
|
||||
if (!$message) {
|
||||
return;
|
||||
}
|
||||
$this->content['subject'] = $message->subject;
|
||||
$this->content['sender'] = $message->getHeader()->decode($message->from);
|
||||
$this->content['receiver'] = $message->getHeader()->decode($message->to);
|
||||
$this->content['senddate'] = $message->date->toDate()->format('d.m.Y');
|
||||
$this->content['emailbody'] = $message->hasHTMLBody() ? $message->getHTMLBody() : $message->getTextBody();
|
||||
$this->renderAttachments($message);
|
||||
}
|
||||
|
||||
protected function renderAttachments(): void {
|
||||
$attachments = $this->mail->getAttachments();
|
||||
protected function renderAttachments($message): void {
|
||||
$attachments = $message->getAttachments();
|
||||
$contentArray = [];
|
||||
foreach ($attachments as $attachment) {
|
||||
$contentArray[] = $attachment->name;
|
||||
|
||||
Reference in New Issue
Block a user