feat(notification): add PDF attachments to ticket availability emails

This commit is contained in:
2026-08-26 08:54:15 -03:00
parent bf02d37a33
commit 8220fb5aaf
5 changed files with 52 additions and 6 deletions

View File

@@ -72,11 +72,15 @@ class MailService extends BaseIntegrationService
return [];
}
/**
* @param array<int, array{data: string, name: string, mime: string}> $attachments
*/
public function send(
string|array $recipient,
string $subject,
string $content,
Tenant|WebsiteType|null $brand = null,
array $attachments = [],
): void {
if (! $this->mailer || ! $this->tenant) {
throw new Exception('MailService no está configurado. Llamá a forTenant() o forClient() primero.');
@@ -105,6 +109,14 @@ class MailService extends BaseIntegrationService
->subject($subject)
->html($html);
foreach ($attachments as $attachment) {
$mail->attachData(
$attachment['data'],
$attachment['name'],
['mime' => $attachment['mime']],
);
}
$this->mailer->to($recipient)->send($mail);
}