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\EmailSpam;
use App\DataMapper\Analytics\Mail\EmailBounce; use App\DataMapper\Analytics\Mail\EmailBounce;
use App\Notifications\Ninja\EmailSpamNotification; use App\Notifications\Ninja\EmailSpamNotification;
use App\Notifications\Ninja\EmailBounceNotification;
class ProcessPostmarkWebhook implements ShouldQueue class ProcessPostmarkWebhook implements ShouldQueue
{ {
@ -103,6 +104,11 @@ class ProcessPostmarkWebhook implements ShouldQueue
case 'Delivery': case 'Delivery':
return $this->processDelivery(); return $this->processDelivery();
case 'Bounce': case 'Bounce':
if($this->request['Subject'] == ctrans('texts.confirmation_subject')) {
$company->notification(new EmailBounceNotification($this->request['Email']))->ninja();
}
return $this->processBounce(); return $this->processBounce();
case 'SpamComplaint': case 'SpamComplaint':
return $this->processSpamComplaint(); 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(); (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) { if($this->is_react) {
$react_redirect = '?react=true'; $react_redirect = '?react=true';
nlog("is react");
} }
$data = [ $data = [

View File

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