allow attaching uploaded files when sending mails

This commit is contained in:
Hendrik Hagendorn
2023-05-27 11:07:46 +02:00
parent ece0c27972
commit a97248555e
5 changed files with 118 additions and 16 deletions

View File

@@ -30,10 +30,15 @@ class SendDocumentAsCustomMail extends Job
$custom_mail['cc'] = user()->email;
}
$attachments = collect($this->request->get('attachments', []))
->filter(fn($value) => $value == true)
->keys()
->all();
$notification = config('type.document.' . $document->type . '.notification.class');
// Notify the contact
$document->contact->notify(new $notification($document, $this->template_alias, true, $custom_mail));
$document->contact->notify(new $notification($document, $this->template_alias, true, $custom_mail, $attachments));
event(new DocumentSent($document));
}