Skip to content

Commit

Permalink
Show an error message to support agent if an emial has not been sent …
Browse files Browse the repository at this point in the history
…after 1 hour - closes freescout-help-desk#3268
  • Loading branch information
freescout-help-desk authored and totake0224 committed Sep 4, 2023
1 parent 803be42 commit 4448048
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/Jobs/SendReplyToCustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,13 @@ public function handle()
$this->release(3600);
}

// If an email has not been sent after 1 hour - show an error message to support agent.
if ($this->attempts() >= 3) {
$this->last_thread->send_status = SendLog::STATUS_SEND_ERROR;
$this->last_thread->updateSendStatusData(['msg' => $error_message]);
$this->last_thread->save();
}

throw $e;
} else {
$this->last_thread->send_status = SendLog::STATUS_SEND_ERROR;
Expand All @@ -311,6 +318,13 @@ public function handle()
}
}

// Clean error message if email finally has been sent.
if ($this->last_thread->send_status == SendLog::STATUS_SEND_ERROR) {
$this->last_thread->send_status = null;
$this->last_thread->updateSendStatusData(['msg' => '']);
$this->last_thread->save();
}

$imap_sent_folder = $mailbox->imap_sent_folder;
if ($imap_sent_folder) {
try {
Expand Down

0 comments on commit 4448048

Please sign in to comment.