diff --git a/web/Modules/Email/App/Filament/Pages/SendEmail.php b/web/Modules/Email/App/Filament/Pages/SendEmail.php new file mode 100644 index 0000000..e6ecf3c --- /dev/null +++ b/web/Modules/Email/App/Filament/Pages/SendEmail.php @@ -0,0 +1,73 @@ +from = 'admin@'; + + return $form + ->schema([ + TextInput::make('from') + ->disabled() + ->columnSpanFull(), + TextInput::make('to') + ->label('To') + ->required() + ->columnSpanFull(), + TextInput::make('subject') + ->label('Subject') + ->required() + ->columnSpanFull(), + Textarea::make('body') + ->rows(10) + ->label('Body') + ->required() + ->columnSpanFull(), + ]); + } + + public function send() + { + if (mail($this->to, $this->subject, $this->body)) { + // Trigger a success notification + Notification::make() + ->title('Email Sent') + ->body('The email has been sent successfully.') + ->send(); + $this->to = ''; + } else { + // Trigger an error notification + Notification::make() + ->title('Email Not Sent') + ->body('The email could not be sent.') + ->send(); + } + } +} diff --git a/web/Modules/Email/resources/views/filament/pages/email-settings.blade.php b/web/Modules/Email/resources/views/filament/pages/email-settings.blade.php index 04575b5..b0eb2e2 100644 --- a/web/Modules/Email/resources/views/filament/pages/email-settings.blade.php +++ b/web/Modules/Email/resources/views/filament/pages/email-settings.blade.php @@ -1,6 +1,6 @@ -
+
Email settings
diff --git a/web/Modules/Email/resources/views/filament/pages/send-email.blade.php b/web/Modules/Email/resources/views/filament/pages/send-email.blade.php new file mode 100644 index 0000000..9c73569 --- /dev/null +++ b/web/Modules/Email/resources/views/filament/pages/send-email.blade.php @@ -0,0 +1,22 @@ + + +
+
+ +
+ {{ $this->form }} +
+ + + Send + Sending... + +
+ + +
+ +