59 lines
1.4 KiB
PHP
59 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications\Netmails;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
use App\Notifications\Netmails;
|
|
use App\Models\{Echomail,Netmail};
|
|
use App\Traits\{MessagePath,PageTemplate};
|
|
|
|
class UnexpectedPacketFromYou extends Netmails
|
|
{
|
|
use MessagePath,PageTemplate;
|
|
|
|
private const LOGKEY = 'NUP';
|
|
|
|
private string $filename;
|
|
|
|
/**
|
|
* Send a sysop a message if they send us echomail and they are not defined with us.
|
|
*
|
|
* @param Echomail $mo
|
|
*/
|
|
public function __construct(string $filename)
|
|
{
|
|
parent::__construct();
|
|
|
|
$this->filename = $filename;
|
|
}
|
|
|
|
/**
|
|
* Get the mail representation of the notification.
|
|
*
|
|
* @param mixed $notifiable
|
|
* @return Netmail
|
|
* @throws \Exception
|
|
*/
|
|
public function toNetmail(object $notifiable): Netmail
|
|
{
|
|
$o = $this->setupNetmail($notifiable);
|
|
$ao = $notifiable->routeNotificationFor(static::via);
|
|
|
|
Log::info(sprintf('%s:+ Creating NETMAIL UNEXPECTED PACKET netmail to [%s]',self::LOGKEY,$ao->ftn));
|
|
|
|
$o->subject = sprintf('Unexpected packet from you [%s]',$this->filename);
|
|
|
|
// Message
|
|
$msg = $this->page(FALSE,'unexpected');
|
|
|
|
$msg->addText("We received a packet from you with echomail, but your node is not defined here. Those echomail messages were ignored. If you think this is a mistake, please let me know.\r\r");
|
|
|
|
$o->msg = $msg->render();
|
|
$o->set_tagline = 'The unexpected moment is always sweeter';
|
|
|
|
$o->save();
|
|
|
|
return $o;
|
|
}
|
|
} |