Skip to content

Commit

Permalink
tec: Fail the Mailer job if the email cannot be sent
Browse files Browse the repository at this point in the history
  • Loading branch information
marienfressinaud committed Jul 26, 2023
1 parent c2c70bd commit 9c4517c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/jobs/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public function perform(string $mailer_class_name, string $mailer_action_name, m
{
$full_class_name = "\\flusio\\mailers\\{$mailer_class_name}";
$mailer = new $full_class_name();
$mailer->$mailer_action_name(...$args);
$result = $mailer->$mailer_action_name(...$args);

if (!$result) {
throw new \Exception("The email {$mailer_class_name}#{$mailer_action_name} cannot be sent.");
}
}
}

0 comments on commit 9c4517c

Please sign in to comment.