added logging to attachment

This commit is contained in:
Martin Folkerts 2024-07-09 16:08:38 +02:00
parent 3ea7eec68e
commit 58d5ce47a1

View file

@ -65,14 +65,16 @@ public function content(): Content
public function attachments(): array
{
return $this->mailing->attachments()->get()->map(function (ProjectMailingAttachment $attachment) {
$mime = 'application/pdf'; // default MIME type
$extension = pathinfo($attachment->path, PATHINFO_EXTENSION);
$attachment_path = $attachment->mailing->project->download_path."/".$attachment->path;
if (!File::exists($attachment_path)) {
logger('Could not find attachment: ' . $attachment_path);
return null;
}
logger('Attachment found: ' . $attachment_path);
$mime = 'application/pdf'; // default MIME type
$extension = pathinfo($attachment->path, PATHINFO_EXTENSION);
if ($extension === 'docx') {
$mime = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
}