Files
anonaddy/app/Notifications/DomainMxRecordsInvalid.php
2022-07-07 08:44:47 +01:00

76 lines
1.9 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 DomainMxRecordsInvalid extends Notification implements ShouldQueue, ShouldBeEncrypted
{
use Queueable;
protected $domain;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($domain)
{
$this->domain = $domain;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$recipient = $notifiable->defaultRecipient;
$fingerprint = $recipient->should_encrypt ? $recipient->fingerprint : null;
return (new MailMessage())
->subject("Your domain's MX records no longer point to AnonAddy")
->markdown('mail.domain_mx_records_invalid', [
'domain' => $this->domain,
'recipientId' => $recipient->_id,
'fingerprint' => $fingerprint
])
->withSymfonyMessage(function (Email $message) {
$message->getHeaders()
->addTextHeader('Feedback-ID', 'DMI:anonaddy');
});
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}