presseportale/app/Mail/ContactRequestSubmitted.php
Kevin Adametz fe1525b9ff auth/mail: Magic-Link-2FA (M1) + Mailversand über die Queue
- Magic-Link-Login übergibt bei aktiviertem 2FA an die 2FA-Challenge,
  statt sie zu umgehen (M1).
- Bestätigungs-/Benachrichtigungs-Mails (Kontakt, Recht, Kündigung,
  Widerruf, Magic-Link) laufen als ShouldQueue+afterCommit über die Queue,
  damit die Response nicht am SMTP-Roundtrip hängt.

Hinweis: Der Queue-Worker muss im Betrieb laufen und überwacht werden, da
fristrelevante Bestätigungen darüber zugestellt werden (siehe
Betriebsüberwachung).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 13:49:21 +00:00

44 lines
1.2 KiB
PHP

<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class ContactRequestSubmitted extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
public function __construct(
public readonly string $senderName,
public readonly string $senderEmail,
public readonly string $messageText,
public readonly string $host,
public readonly ?string $topicLabel = null,
public readonly ?string $pageUrl = null,
) {}
public function envelope(): Envelope
{
$subject = 'Neue Kontaktanfrage über '.$this->host;
if ($this->topicLabel !== null && $this->topicLabel !== 'Kontaktaufnahme') {
$subject = 'Neue '.$this->topicLabel.' über '.$this->host;
}
return new Envelope(
subject: $subject,
replyTo: [new Address($this->senderEmail, $this->senderName)],
);
}
public function content(): Content
{
return new Content(view: 'emails.contact.submitted');
}
}