From 04242fc3af350673a6f9edbe3e3255c37ea73ae1 Mon Sep 17 00:00:00 2001
From: MaxGiting <MaxGiting@users.noreply.github.com>
Date: Tue, 8 Mar 2022 11:27:06 +0000
Subject: [PATCH 1/3] Add retryUntil method to queued mailables

---
 src/Illuminate/Mail/SendQueuedMailable.php | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/Illuminate/Mail/SendQueuedMailable.php b/src/Illuminate/Mail/SendQueuedMailable.php
index 1009789b4bf0..b36fbfa7c66d 100644
--- a/src/Illuminate/Mail/SendQueuedMailable.php
+++ b/src/Illuminate/Mail/SendQueuedMailable.php
@@ -102,6 +102,20 @@ public function backoff()
         return $this->mailable->backoff ?? $this->mailable->backoff();
     }
 
+    /**
+     * Get the expiration for the notification.
+     *
+     * @return mixed
+     */
+    public function retryUntil()
+    {
+        if (! method_exists($this->mailable, 'retryUntil') && ! isset($this->mailable->retryUntil)) {
+            return;
+        }
+
+        return $this->mailable->retryUntil ?? $this->mailable->retryUntil();
+    }
+
     /**
      * Prepare the instance for cloning.
      *

From 1a750c0644bdeb6b5a7725897cfadf4bba62372e Mon Sep 17 00:00:00 2001
From: MaxGiting <MaxGiting@users.noreply.github.com>
Date: Tue, 8 Mar 2022 13:36:02 +0000
Subject: [PATCH 2/3] Update src/Illuminate/Mail/SendQueuedMailable.php

Co-authored-by: Mark Beech <mbeech@mark-beech.co.uk>
---
 src/Illuminate/Mail/SendQueuedMailable.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Illuminate/Mail/SendQueuedMailable.php b/src/Illuminate/Mail/SendQueuedMailable.php
index b36fbfa7c66d..52b36d8eaef2 100644
--- a/src/Illuminate/Mail/SendQueuedMailable.php
+++ b/src/Illuminate/Mail/SendQueuedMailable.php
@@ -103,7 +103,7 @@ public function backoff()
     }
 
     /**
-     * Get the expiration for the notification.
+     * Get the expiration for the mailable.
      *
      * @return mixed
      */

From 7c9922d5db97ae5fa89ee3370cd4d78e4b177ba2 Mon Sep 17 00:00:00 2001
From: Taylor Otwell <taylor@laravel.com>
Date: Tue, 8 Mar 2022 09:47:58 -0600
Subject: [PATCH 3/3] Update SendQueuedMailable.php

---
 src/Illuminate/Mail/SendQueuedMailable.php | 46 +++++++++++-----------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/src/Illuminate/Mail/SendQueuedMailable.php b/src/Illuminate/Mail/SendQueuedMailable.php
index 52b36d8eaef2..7d340e4d4e22 100644
--- a/src/Illuminate/Mail/SendQueuedMailable.php
+++ b/src/Illuminate/Mail/SendQueuedMailable.php
@@ -65,29 +65,6 @@ public function handle(MailFactory $factory)
         $this->mailable->send($factory);
     }
 
-    /**
-     * Get the display name for the queued job.
-     *
-     * @return string
-     */
-    public function displayName()
-    {
-        return get_class($this->mailable);
-    }
-
-    /**
-     * Call the failed method on the mailable instance.
-     *
-     * @param  \Throwable  $e
-     * @return void
-     */
-    public function failed($e)
-    {
-        if (method_exists($this->mailable, 'failed')) {
-            $this->mailable->failed($e);
-        }
-    }
-
     /**
      * Get the number of seconds before a released mailable will be available.
      *
@@ -116,6 +93,29 @@ public function retryUntil()
         return $this->mailable->retryUntil ?? $this->mailable->retryUntil();
     }
 
+    /**
+     * Call the failed method on the mailable instance.
+     *
+     * @param  \Throwable  $e
+     * @return void
+     */
+    public function failed($e)
+    {
+        if (method_exists($this->mailable, 'failed')) {
+            $this->mailable->failed($e);
+        }
+    }
+
+    /**
+     * Get the display name for the queued job.
+     *
+     * @return string
+     */
+    public function displayName()
+    {
+        return get_class($this->mailable);
+    }
+
     /**
      * Prepare the instance for cloning.
      *