Deon George
fc930ba6c2
This function is used to get the true date of a message (taking into account the TZ), and needed when creating the TZUTC
This reverts commit ad0ad73b0c
.
73 lines
1.7 KiB
PHP
73 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications\Netmails;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
use App\Notifications\Netmails;
|
|
use App\Models\Netmail;
|
|
use App\Traits\{MessagePath,PageTemplate};
|
|
|
|
class NetmailHubNoUser extends Netmails
|
|
{
|
|
use MessagePath,PageTemplate;
|
|
|
|
private const LOGKEY = 'NNP';
|
|
|
|
private Netmail $mo;
|
|
|
|
/**
|
|
* Reply to a netmail ping request.
|
|
*
|
|
* @param Netmail $mo
|
|
*/
|
|
public function __construct(Netmail $mo)
|
|
{
|
|
parent::__construct();
|
|
|
|
$this->mo = $mo;
|
|
}
|
|
|
|
/**
|
|
* 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 HUB NO USER netmail to [%s]',self::LOGKEY,$ao->ftn));
|
|
|
|
$o->to = $this->mo->from;
|
|
$o->replyid = $this->mo->msgid;
|
|
$o->subject = 'Message Undeliverable - '.$this->mo->msgid;
|
|
|
|
// Message
|
|
$msg = $this->page(FALSE,'Reject');
|
|
|
|
$msg->addText(
|
|
sprintf("Your netmail 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,
|
|
$this->mo->to,
|
|
Carbon::now()->utc()->toDateTimeString(),
|
|
$this->mo->date->utc()->toDateTimeString(),
|
|
)
|
|
);
|
|
|
|
$msg->addText("This hub is not attended, so no user will be able to read your message. You may like to try and contact them another way.\r\r");
|
|
|
|
$msg->addText($this->message_path($this->mo));
|
|
|
|
$o->msg = $msg->render();
|
|
$o->set_tagline = 'Do you think it was fate which brought us together? Nah, bad luck :(';
|
|
|
|
$o->save();
|
|
|
|
return $o;
|
|
}
|
|
} |