2023-07-29 03:17:36 +00:00
< ? php
namespace App\Notifications\Netmails ;
use Carbon\Carbon ;
use Illuminate\Support\Facades\Log ;
use App\Classes\FTN\Message ;
use App\Notifications\Netmails ;
2024-05-17 12:10:54 +00:00
use App\Models\ { Echomail , Netmail };
2023-07-29 03:17:36 +00:00
use App\Traits\ { MessagePath , PageTemplate };
class EchoareaNotExist extends Netmails
{
use MessagePath , PageTemplate ;
private const LOGKEY = 'NNW' ;
2024-05-17 12:10:54 +00:00
private Echomail $mo ;
2023-07-29 03:17:36 +00:00
/**
* Send a sysop a message if they attempt to write to an area that doesnt exist .
*
* @ param Message $mo
*/
2024-05-17 12:10:54 +00:00
public function __construct ( Echomail $mo )
2023-07-29 03:17:36 +00:00
{
parent :: __construct ();
$this -> mo = $mo ;
}
/**
* Get the mail representation of the notification .
*
* @ param mixed $notifiable
* @ return Netmail
* @ throws \Exception
*/
2023-12-18 04:13:16 +00:00
public function toNetmail ( object $notifiable ) : Netmail
2023-07-29 03:17:36 +00:00
{
2023-12-18 04:13:16 +00:00
$o = $this -> setupNetmail ( $notifiable );
2023-07-29 03:17:36 +00:00
$ao = $notifiable -> routeNotificationFor ( static :: via );
2024-05-19 13:28:45 +00:00
Log :: info ( sprintf ( '%s:+ Creating ECHOAREA NOT EXIST netmail to [%s]' , self :: LOGKEY , $ao -> ftn ));
2023-07-29 03:17:36 +00:00
2024-05-26 02:35:13 +00:00
$o -> to = $this -> mo -> from ;
2024-05-17 12:10:54 +00:00
$o -> subject = 'Echoarea doesnt exist - ' . $this -> mo -> set -> get ( 'set_echoarea' );
2023-07-29 03:17:36 +00:00
// Message
$msg = $this -> page ( FALSE , 'nothere' );
$msg -> addText (
sprintf ( " Your echomail with ID [%s] to [%s] here was received here on [%s] and it looks like you sent it on [%s]. \r \r " ,
$this -> mo -> msgid ,
2024-05-17 12:10:54 +00:00
$this -> mo -> to ,
2023-07-29 03:17:36 +00:00
Carbon :: now () -> utc () -> toDateTimeString (),
$this -> mo -> date -> utc () -> toDateTimeString (),
)
);
2024-05-19 13:28:45 +00:00
$msg -> addText ( sprintf ( " It appears that the echoarea [%s] that this message is for doesnt exist, so the message from your system was rejected. \r \r " , $this -> mo -> set -> get ( 'set_echoarea' )));
2023-07-29 03:17:36 +00:00
$msg -> addText ( " Please contact the ZC if you think this is a mistake. \r \r " );
$msg -> addText ( $this -> message_path ( $this -> mo ));
$o -> msg = $msg -> render ();
$o -> tagline = 'Don\'t let your trash become someone else\'s treasure. Feed your shredder often.' ;
$o -> save ();
return $o ;
}
}