mirror of
https://github.com/anonaddy/anonaddy
synced 2026-04-25 17:15:29 +02:00
70 lines
2.0 KiB
PHP
70 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Notifications\Notification;
|
|
use Symfony\Component\Mime\Email;
|
|
|
|
class AliasDeactivatedByUnsubscribeNotification extends Notification implements ShouldBeEncrypted, ShouldQueue
|
|
{
|
|
use Queueable;
|
|
|
|
public function __construct(
|
|
protected string $aliasEmail,
|
|
protected string $aliasId,
|
|
protected ?string $ipAddress = null,
|
|
protected ?string $userAgent = null,
|
|
protected ?string $timestamp = null,
|
|
) {}
|
|
|
|
/**
|
|
* @param mixed $notifiable
|
|
* @return array
|
|
*/
|
|
public function via($notifiable)
|
|
{
|
|
return ['mail'];
|
|
}
|
|
|
|
/**
|
|
* @param mixed $notifiable
|
|
* @return MailMessage
|
|
*/
|
|
public function toMail($notifiable)
|
|
{
|
|
$recipient = $notifiable->defaultRecipient;
|
|
$fingerprint = $recipient->should_encrypt ? $recipient->fingerprint : null;
|
|
|
|
return (new MailMessage)
|
|
->subject('Alias deactivated via one-click unsubscribe')
|
|
->markdown('mail.alias_deactivated_by_unsubscribe', [
|
|
'aliasEmail' => $this->aliasEmail,
|
|
'aliasId' => $this->aliasId,
|
|
'ipAddress' => $this->ipAddress,
|
|
'userAgent' => $this->userAgent,
|
|
'timestamp' => $this->timestamp,
|
|
'userId' => $notifiable->id,
|
|
'recipientId' => $notifiable->default_recipient_id,
|
|
'emailType' => 'ADUN',
|
|
'fingerprint' => $fingerprint,
|
|
])
|
|
->withSymfonyMessage(function (Email $message) {
|
|
$message->getHeaders()
|
|
->addTextHeader('Feedback-ID', 'ADUN:anonaddy');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @param mixed $notifiable
|
|
* @return array
|
|
*/
|
|
public function toArray($notifiable)
|
|
{
|
|
return [];
|
|
}
|
|
}
|