From ace58dd1dfca7019772ab0ed66ce6bd1bb2f826f Mon Sep 17 00:00:00 2001 From: ayan4m1 Date: Sat, 15 Sep 2018 19:53:59 -0400 Subject: [PATCH] allow test of mail system no matter the type --- .../Admin/Settings/MailController.php | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/app/Http/Controllers/Admin/Settings/MailController.php b/app/Http/Controllers/Admin/Settings/MailController.php index ab9e528f3..0b9088b0b 100644 --- a/app/Http/Controllers/Admin/Settings/MailController.php +++ b/app/Http/Controllers/Admin/Settings/MailController.php @@ -94,7 +94,7 @@ class MailController extends Controller public function update(MailSettingsFormRequest $request): RedirectResponse { if ($this->config->get('mail.driver') !== 'smtp') { - throw $this->smtpNotSelectedException(); + throw new DisplayException('This feature is only available if SMTP is the selected email driver for the Panel.'); } $values = $request->normalize(); @@ -119,16 +119,11 @@ class MailController extends Controller /** * Submit a request to send a test mail message. * - * @throws DisplayException * @param Request $request * @return \Illuminate\Http\RedirectResponse */ public function test(Request $request): RedirectResponse { - if ($this->config->get('mail.driver') !== 'smtp') { - throw $this->smtpNotSelectedException(); - } - try { Notification::route('mail', $request->user()->email) ->notify(new MailTested($request->user())); @@ -140,13 +135,4 @@ class MailController extends Controller $this->alert->success(trans('base.mail.test_succeeded'))->flash(); return redirect()->route('admin.settings.mail'); } - - /** - * Generate a display exception for non-SMTP configurations. - * - * @return DisplayException - */ - private function smtpNotSelectedException() { - return new DisplayException('This feature is only available if SMTP is the selected email driver for the Panel.'); - } }