diff --git a/app/Http/Controllers/Api/SettingsController.php b/app/Http/Controllers/Api/SettingsController.php
index f8ba5942bd..820dc7216b 100644
--- a/app/Http/Controllers/Api/SettingsController.php
+++ b/app/Http/Controllers/Api/SettingsController.php
@@ -170,16 +170,19 @@ class SettingsController extends Controller
*/
public function ajaxTestEmail()
{
- try {
- Mail::send('emails.test', [], function ($m) {
- $m->to(config('mail.from.address'), config('mail.from.name'));
- $m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
- $m->subject(trans('mail.test_email'));
- });
- return response()->json(['message' => 'Mail sent! '], 200);
- } catch (Exception $e) {
- return response()->json(['message' => $e->getMessage()], 500);
+ if (!config('app.lock_passwords')) {
+ try {
+ Mail::send('emails.test', [], function ($m) {
+ $m->to(config('mail.from.address'), config('mail.from.name'));
+ $m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
+ $m->subject(trans('mail.test_email'));
+ });
+ return response()->json(['message' => 'Mail sent to '.config('mail.from.address')], 200);
+ } catch (Exception $e) {
+ return response()->json(['message' => $e->getMessage()], 500);
+ }
}
+ return response()->json(['message' => 'Mail would have been sent, but this application is in demo mode! '], 200);
}
diff --git a/resources/views/settings/general.blade.php b/resources/views/settings/general.blade.php
index ffa7ad9548..99bbc17a40 100644
--- a/resources/views/settings/general.blade.php
+++ b/resources/views/settings/general.blade.php
@@ -250,12 +250,17 @@
dataType: 'json',
success: function (data) {
+ console.dir(data);
$("#mailtesticon").html('');
$("#mailteststatus").html('');
$('#mailteststatus-error').html('');
$("#mailteststatus").removeClass('text-danger');
$("#mailteststatus").addClass('text-success');
- $("#mailteststatus").html(' Mail sent!');
+ if (data.message) {
+ $("#mailteststatus").html(' ' + data.message);
+ } else {
+ $("#mailteststatus").html(' Mail sent!');
+ }
},
error: function (data) {