connectToImap()) { $this->templateName = 'imaperror'; return; } $params = $this->getUriParams(); $this->uid = $params['uid']; $this->folder = url_decode($params['folder']); $this->content['uid'] = $this->uid; } protected function generateContent(): void { $this->mail = $this->fetchEmail(); $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(); } protected function renderAttachments(): void { $attachments = $this->mail->getAttachments(); $contentArray = []; foreach ($attachments as $attachment) { $contentArray[] = $attachment->name; } $this->content['attachments'] = implode('
', $contentArray); } }