Skip to content

[12.x] Mailable::later() does not set delay on SendQueuedMailable instance#58765

Merged
taylorotwell merged 1 commit intolaravel:12.xfrom
amirhshokri:12.x-set-delay-on-SendQueuedMailable
Feb 12, 2026
Merged

[12.x] Mailable::later() does not set delay on SendQueuedMailable instance#58765
taylorotwell merged 1 commit intolaravel:12.xfrom
amirhshokri:12.x-set-delay-on-SendQueuedMailable

Conversation

@amirhshokri
Copy link
Contributor

@amirhshokri amirhshokri commented Feb 11, 2026

Description

When queuing mail using:

Mail::to($user)->later($delay, new ExampleMail());

the delay is correctly applied at the queue driver level and the job is executed at the expected time.

However, the delay value is not set on the SendQueuedMailable job instance itself.

Because of this:

  • The delay is respected by the queue system.
  • But the delay is not present in the serialized job payload.
  • Queue observers (e.g., Horizon) cannot detect that the job is delayed.
  • The job appears as a normal pending job instead of a delayed one.

This creates an inconsistency with:

dispatch(new ExampleJob())->delay($delay);

where the delay is stored on the job instance and included in the payload metadata.

Root Cause

Mailable::later() currently forwards the delay directly to the queue driver via:

$queue->connection($connection)->laterOn(
    $queueName ?: null, $delay, $this->newQueuedJob()
);

The delay is applied at the driver level but never set on the SendQueuedMailable instance, which uses the Queueable trait.

Proposed Fix

Set the delay on the queued job instance, aligning behavior with dispatch()->delay().

@taylorotwell taylorotwell merged commit f48be12 into laravel:12.x Feb 12, 2026
71 checks passed
@amirhshokri amirhshokri deleted the 12.x-set-delay-on-SendQueuedMailable branch February 12, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants