feat(mail-test): enhance email functionality with tenant branding and routing

This commit is contained in:
2026-07-21 16:26:46 -03:00
parent 1a05c380a0
commit 22da4966e9
7 changed files with 194 additions and 15 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Domains\MailTest\Mailables;
use App\Domains\Tenant\Models\Tenant;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
@@ -15,6 +16,7 @@ class TestMail extends Mailable
public function __construct(
public readonly string $mailSubject,
public readonly string $mailMessage,
public readonly Tenant $tenant,
) {}
public function envelope(): Envelope
@@ -24,14 +26,15 @@ class TestMail extends Mailable
public function content(): Content
{
$message = nl2br(e($this->mailMessage));
$this->tenant->loadMissing(['headerLogo', 'footerLogo']);
return new Content(
htmlString: <<<HTML
<h1>Prueba de correo de Shopit</h1>
<p>{$message}</p>
<p><small>Si recibiste este mensaje, la configuracion de correo funciona correctamente.</small></p>
HTML,
view: 'mail.test',
with: [
'tenant' => $this->tenant,
'headerLogoUrl' => $this->tenant->headerLogo?->getTemporaryUrl(1440),
'footerLogoUrl' => $this->tenant->footerLogo?->getTemporaryUrl(1440),
],
);
}
}