From 369f8e48fe9e8f15d5d5656d514bbbef1cad98a7 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 4 Dec 2022 14:27:47 +1100 Subject: [PATCH] Enabled email test command --- app/Console/Commands/SendTestEmail.php | 39 +++++++++++++++ app/Mail/TestEmail.php | 48 +++++++++++++++++++ .../views/mail/system/test_email.blade.php | 31 ++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 app/Console/Commands/SendTestEmail.php create mode 100644 app/Mail/TestEmail.php create mode 100644 resources/views/mail/system/test_email.blade.php diff --git a/app/Console/Commands/SendTestEmail.php b/app/Console/Commands/SendTestEmail.php new file mode 100644 index 0000000..460e68f --- /dev/null +++ b/app/Console/Commands/SendTestEmail.php @@ -0,0 +1,39 @@ +argument('id')); + + Mail::to($uo->email) + ->send(new MailTest($uo)); + } +} \ No newline at end of file diff --git a/app/Mail/TestEmail.php b/app/Mail/TestEmail.php new file mode 100644 index 0000000..d2f01e3 --- /dev/null +++ b/app/Mail/TestEmail.php @@ -0,0 +1,48 @@ +user = $o; + } + + /** + * Build the message. + * + * @return $this + */ + public function build() + { + $this->setup = Setup::findOrFail(config('app.id')); + + return $this + ->markdown('mail.system.test_email') + ->subject('Just a test...') + ->with([ + 'url'=>'https://localhost', + ]); + } +} diff --git a/resources/views/mail/system/test_email.blade.php b/resources/views/mail/system/test_email.blade.php new file mode 100644 index 0000000..1d4d364 --- /dev/null +++ b/resources/views/mail/system/test_email.blade.php @@ -0,0 +1,31 @@ +@component('mail::message',['heading'=>'System Test Email!']) +Hi {{ isset($user) ? $user->name.',' : '' }} + +This is just a test email to validate that you can receive emails from us. + +@component('mail::panel') +NO ACTION REQUIRED! +@endcomponent + +@component('mail::subcopy') +System Test Messsage +@endcomponent + +@if($user->systems) +@component('mail::table') +| System Name | Address | FTNs | +| ------------- |:-------------:| --------:| +@foreach ($user->systems as $so) +| {{ $so->name }} | {{ $so->mailer_address }} | {{ $so->addresses->pluck('ftn3d')->join(', ') }} | +@endforeach +@endcomponent +@endif + +@component('mail::button', ['url' => $url, 'color' => 'success']) +{{ config('mail.from.name') }} +@endcomponent + +Thanks, + +{{ $setup->system->sysop }} +@endcomponent \ No newline at end of file