2023-07-23 07:27:52 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Notifications\Echomails;
|
|
|
|
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use Carbon\CarbonInterface;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
2024-05-19 13:28:45 +00:00
|
|
|
use App\Classes\{Fonts\Thick,Fonts\Thin,Page};
|
2024-05-25 12:25:57 +00:00
|
|
|
use App\Models\{Echomail,Setup};
|
2023-07-23 07:27:52 +00:00
|
|
|
use App\Notifications\Echomails;
|
|
|
|
use App\Traits\MessagePath;
|
|
|
|
|
|
|
|
class Test extends Echomails
|
|
|
|
{
|
|
|
|
use MessagePath;
|
|
|
|
|
|
|
|
private const LOGKEY = 'NNP';
|
|
|
|
|
2024-05-19 13:28:45 +00:00
|
|
|
private Echomail $mo;
|
2023-07-23 07:27:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Reply to a netmail ping request.
|
|
|
|
*
|
2024-05-19 13:28:45 +00:00
|
|
|
* @param Echomail $mo
|
2023-07-23 07:27:52 +00:00
|
|
|
*/
|
2024-05-19 13:28:45 +00:00
|
|
|
public function __construct(Echomail $mo)
|
2023-07-23 07:27:52 +00:00
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
$this->mo = $mo;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the mail representation of the notification.
|
|
|
|
*
|
|
|
|
* @param mixed $notifiable
|
|
|
|
* @return Echomail
|
|
|
|
* @throws \Exception
|
|
|
|
*/
|
2023-12-18 04:13:16 +00:00
|
|
|
public function toEchomail(object $notifiable): Echomail
|
2023-07-23 07:27:52 +00:00
|
|
|
{
|
|
|
|
$echoarea = $notifiable->routeNotificationFor(static::via);
|
2024-05-25 12:25:57 +00:00
|
|
|
$o = $this->setupEchomail($echoarea);
|
2023-07-23 07:27:52 +00:00
|
|
|
|
2024-05-19 13:28:45 +00:00
|
|
|
Log::info(sprintf('%s:+ Creating TEST echomail in [%s]',self::LOGKEY,$echoarea->name));
|
2023-07-23 07:27:52 +00:00
|
|
|
|
2024-05-19 13:28:45 +00:00
|
|
|
$o->to = $this->mo->from;
|
2024-05-25 12:25:57 +00:00
|
|
|
$o->fftn_id = ($x=our_address($this->mo->fftn))->id;
|
|
|
|
$o->replyid = $this->mo->msgid;
|
2023-07-23 07:27:52 +00:00
|
|
|
$o->subject = 'Test Reply';
|
2024-05-25 12:25:57 +00:00
|
|
|
$o->kludges->put('CHRS:',$this->mo->kludges->get('chrs') ?: 'CP437 2');
|
2023-07-23 07:27:52 +00:00
|
|
|
|
|
|
|
// Message
|
|
|
|
$msg = new Page;
|
|
|
|
|
|
|
|
$header = new Thick;
|
|
|
|
$header->addText('Clearing Houz');
|
|
|
|
$msg->addHeader($header,'FTN Mailer and Tosser',TRUE,0xc4);
|
|
|
|
|
|
|
|
$lbc = new Thin;
|
|
|
|
$lbc->addText('Test');
|
|
|
|
$msg->addLeftBoxContent($lbc,TRUE);
|
|
|
|
|
|
|
|
$msg->addText(
|
|
|
|
sprintf("Your test was received here on %s and it looks like you sent it on %s. If that is correct, then it took %s to get here.\r\r",
|
|
|
|
Carbon::now()->utc()->toDateTimeString(),
|
|
|
|
$this->mo->date->utc()->toDateTimeString(),
|
|
|
|
$this->mo->date->diffForHumans(['parts'=>3,'syntax'=>CarbonInterface::DIFF_ABSOLUTE])
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
$msg->addText($this->message_path($this->mo));
|
|
|
|
|
|
|
|
$o->msg = $msg->render();
|
2024-06-03 09:08:40 +00:00
|
|
|
$o->set_tagline = 'I ate a clock yesterday, it was very time-consuming.';
|
|
|
|
$o->set_origin = sprintf('%s (%s)',Setup::PRODUCT_NAME,$x->ftn4d);
|
2023-07-23 07:27:52 +00:00
|
|
|
|
|
|
|
$o->save();
|
|
|
|
|
|
|
|
return $o;
|
|
|
|
}
|
|
|
|
}
|