Notify on bounced account creation email

This commit is contained in:
David Bomba 2023-12-26 14:57:36 +11:00
parent d0358086fc
commit 338e7a0037
3 changed files with 8 additions and 11 deletions

View File

@ -30,6 +30,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
use App\DataMapper\Analytics\Mail\EmailSpam;
use App\DataMapper\Analytics\Mail\EmailBounce;
use App\Notifications\Ninja\EmailSpamNotification;
use App\Notifications\Ninja\EmailBounceNotification;
class ProcessPostmarkWebhook implements ShouldQueue
{
@ -103,6 +104,11 @@ class ProcessPostmarkWebhook implements ShouldQueue
case 'Delivery':
return $this->processDelivery();
case 'Bounce':
if($this->request['Subject'] == ctrans('texts.confirmation_subject')) {
$company->notification(new EmailBounceNotification($this->request['Email']))->ninja();
}
return $this->processBounce();
case 'SpamComplaint':
return $this->processSpamComplaint();
@ -263,8 +269,6 @@ class ProcessPostmarkWebhook implements ShouldQueue
(new SystemLogger($data, SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_BOUNCED, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client, $this->invitation->company))->handle();
// if(config('ninja.notification.slack'))
// $this->invitation->company->notification(new EmailBounceNotification($this->invitation->company->account))->ninja();
}
// {

View File

@ -42,7 +42,6 @@ class VerifyUserObject
if($this->is_react) {
$react_redirect = '?react=true';
nlog("is react");
}
$data = [

View File

@ -21,11 +21,9 @@ class EmailBounceNotification extends Notification
*
* @return void
*/
protected $account;
public function __construct($account)
public function __construct(private string $email_address)
{
$this->account = $account;
}
/**
@ -64,11 +62,7 @@ class EmailBounceNotification extends Notification
public function toSlack($notifiable)
{
$content = "Email bounce notification for Account {$this->account->key} \n";
$owner = $this->account->companies()->first()->owner();
$content .= "Owner {$owner->present()->name() } | {$owner->email}";
$content = "Email bounce notification for {$this->email_address} \n";
return (new SlackMessage)
->success()