Queued email jobs return success but do not send email, sometimes

I am using a database queue to send email. Most of the time it works, but sometimes the email fails to send, but the job completes successfully.

Here is some relevant code:

In the controller:

      Mail::to('[email protected]')->send(new NewPatientNotification("test", "email.newpatient"));

The mailable

class NewPatientNotification extends Mailable implements ShouldQueue
{
  use Queueable, SerializesModels;

  public function __construct(public string $subj, public string $viewName)
  {
  }

  public function build()
  {
    log_info("New Patient Notification Build");
    return $this->subject($this->subj)->view($this->viewName);
  }
}

I increased the logging, specifically logging on the MessageSent event as so:

  public function handle(MessageSent $event): void
  {
    log_info("MessageSent: Message-ID: " . $event->sent->getSymfonySentMessage()->getMessageId() . " SMTP Dialog: " . $event->sent->getSymfonySentMessage()->getDebug());
  }

For messages that get sent, the log contains something like this:

LOG: [user_id=0]AppListenersLogSentMessage@handle(479): MessageSent: Message-ID: [email protected] SMTP Dialog: [2025-04-05T00:07:59.939621-04:00] > NOOP
[2025-04-05T00:07:59.984086-04:00] < 250 2.0.0 OK
[2025-04-05T00:07:59.984156-04:00] > MAIL FROM:<[email protected]>
[2025-04-05T00:08:00.033643-04:00] < 250 2.1.0 Sender OK
[2025-04-05T00:08:00.033694-04:00] > RCPT TO:<[email protected]>
[2025-04-05T00:08:00.078450-04:00] < 250 2.1.5 Recipient OK
[2025-04-05T00:08:00.078487-04:00] > RCPT TO:<[email protected]>
[2025-04-05T00:08:00.123072-04:00] < 250 2.1.5 Recipient OK

For messages that fail to send, the SMTP dialog is empty

LOG: [user_id=0]AppListenersLogSentMessage@handle(479): MessageSent: Message-ID: [email protected] SMTP Dialog: ;

The only thing I noticed is the emails that are sent tend to take 500ms or more. The ones that don’t send tend to be 100ms or less. Apologies for crossposting this in https://laracasts.com/discuss/channels/laravel/queued-emails-are-intermittently-not-sent-but-jobs-are-completing-successfully