From 0cd889942c7dfd17c25551aab681eb6d9a96182a Mon Sep 17 00:00:00 2001 From: Alexander-- Date: Thu, 1 Feb 2018 21:32:07 -0500 Subject: [PATCH 1/2] =?UTF-8?q?Move=20up=20message=20=D1=81ustomization=20?= =?UTF-8?q?callbacks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Illuminate/Mail/Mailer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Mail/Mailer.php b/src/Illuminate/Mail/Mailer.php index 8eea89ffb3a1..b36bd9c29131 100755 --- a/src/Illuminate/Mail/Mailer.php +++ b/src/Illuminate/Mail/Mailer.php @@ -225,13 +225,13 @@ public function send($view, array $data = [], $callback = null) $data['message'] = $message = $this->createMessage(); + call_user_func($callback, $message); + // Once we have retrieved the view content for the e-mail we will set the body // of this message using the HTML type, which will provide a simple wrapper // to creating view based emails that are able to receive arrays of data. $this->addContent($message, $view, $plain, $raw, $data); - call_user_func($callback, $message); - // If a global "to" address has been set, we will set that address on the mail // message. This is primarily useful during local development in which each // message should be delivered into a single mail address for inspection. From 740cc6133277299b4bcd70f9c2913a42df1429a3 Mon Sep 17 00:00:00 2001 From: Alexander-- Date: Thu, 1 Feb 2018 21:35:23 -0500 Subject: [PATCH 2/2] Allow customization of email body and attachments --- src/Illuminate/Mail/Mailable.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Mail/Mailable.php b/src/Illuminate/Mail/Mailable.php index 0e7bb7554e1f..5a412c90a900 100644 --- a/src/Illuminate/Mail/Mailable.php +++ b/src/Illuminate/Mail/Mailable.php @@ -128,8 +128,8 @@ public function send(MailerContract $mailer) $this->buildFrom($message) ->buildRecipients($message) ->buildSubject($message) - ->buildAttachments($message) - ->runCallbacks($message); + ->runCallbacks($message) + ->buildAttachments($message); }); }