diff --git a/app/Http/Controllers/Api/SettingsController.php b/app/Http/Controllers/Api/SettingsController.php
index 942c4a5fe4..0d44337e5d 100644
--- a/app/Http/Controllers/Api/SettingsController.php
+++ b/app/Http/Controllers/Api/SettingsController.php
@@ -10,6 +10,7 @@ use App\Models\Setting;
use Mail;
use App\Notifications\SlackTest;
use Notification;
+use App\Notifications\MailTest;
class SettingsController extends Controller
{
@@ -132,11 +133,13 @@ class SettingsController extends Controller
{
if (!config('app.lock_passwords')) {
try {
- Mail::send('emails.test', [], function ($m) {
+ Notification::send(Setting::first(), new MailTest());
+
+ /*Mail::send('emails.test', [], function ($m) {
$m->to(config('mail.reply_to.address'), config('mail.reply_to.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.reply_to.address')], 200);
} catch (Exception $e) {
return response()->json(['message' => $e->getMessage()], 500);
diff --git a/app/Models/Setting.php b/app/Models/Setting.php
index 7c824b9e62..71dfbbaae3 100755
--- a/app/Models/Setting.php
+++ b/app/Models/Setting.php
@@ -180,6 +180,13 @@ class Setting extends Model
return $this->slack_endpoint;
}
+ public function routeNotificationForMail()
+ {
+ // At this point the endpoint is the same for everything.
+ // In the future this may want to be adapted for individual notifications.
+ return config('mail.reply_to.address');
+ }
+
public static function passwordComplexityRulesSaving($action = 'update')
{
$security_rules = '';
diff --git a/app/Notifications/MailTest.php b/app/Notifications/MailTest.php
new file mode 100644
index 0000000000..421cf7f988
--- /dev/null
+++ b/app/Notifications/MailTest.php
@@ -0,0 +1,61 @@
+subject(trans('mail.test_email'))
+ ->markdown('notifications.Test');
+ }
+
+ /**
+ * Get the array representation of the notification.
+ *
+ * @param mixed $notifiable
+ * @return array
+ */
+ public function toArray($notifiable)
+ {
+ return [
+ //
+ ];
+ }
+}
diff --git a/resources/views/notifications/Test.blade.php b/resources/views/notifications/Test.blade.php
new file mode 100644
index 0000000000..a651f2f3f1
--- /dev/null
+++ b/resources/views/notifications/Test.blade.php
@@ -0,0 +1,7 @@
+@component('mail::message')
+
+{{ trans('mail.test_mail_text') }}
+
+Thanks,
+{{ $snipeSettings->site_name }}
+@endcomponent
diff --git a/resources/views/vendor/mail/html/layout.blade.php b/resources/views/vendor/mail/html/layout.blade.php
index 991ae52a88..c7c629d4a4 100644
--- a/resources/views/vendor/mail/html/layout.blade.php
+++ b/resources/views/vendor/mail/html/layout.blade.php
@@ -21,6 +21,10 @@
width: 100% !important;
}
}
+ .logo {
+ width:50px;
+ height:50px;
+ }