allow test of mail system no matter the type
This commit is contained in:
parent
1b03ae2efe
commit
ace58dd1df
1 changed files with 1 additions and 15 deletions
|
@ -94,7 +94,7 @@ class MailController extends Controller
|
||||||
public function update(MailSettingsFormRequest $request): RedirectResponse
|
public function update(MailSettingsFormRequest $request): RedirectResponse
|
||||||
{
|
{
|
||||||
if ($this->config->get('mail.driver') !== 'smtp') {
|
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();
|
$values = $request->normalize();
|
||||||
|
@ -119,16 +119,11 @@ class MailController extends Controller
|
||||||
/**
|
/**
|
||||||
* Submit a request to send a test mail message.
|
* Submit a request to send a test mail message.
|
||||||
*
|
*
|
||||||
* @throws DisplayException
|
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function test(Request $request): RedirectResponse
|
public function test(Request $request): RedirectResponse
|
||||||
{
|
{
|
||||||
if ($this->config->get('mail.driver') !== 'smtp') {
|
|
||||||
throw $this->smtpNotSelectedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Notification::route('mail', $request->user()->email)
|
Notification::route('mail', $request->user()->email)
|
||||||
->notify(new MailTested($request->user()));
|
->notify(new MailTested($request->user()));
|
||||||
|
@ -140,13 +135,4 @@ class MailController extends Controller
|
||||||
$this->alert->success(trans('base.mail.test_succeeded'))->flash();
|
$this->alert->success(trans('base.mail.test_succeeded'))->flash();
|
||||||
return redirect()->route('admin.settings.mail');
|
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.');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue