File tree Expand file tree Collapse file tree 4 files changed +39
-0
lines changed
Expand file tree Collapse file tree 4 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 77use Illuminate \Auth \Events \Registered ;
88use Illuminate \Support \Facades \Schema ;
99use Illuminate \Support \Facades \File ;
10+ use Illuminate \Support \Facades \Mail ;
1011
1112use GeoSot \EnvEditor \Controllers \EnvController ;
1213use GeoSot \EnvEditor \Exceptions \EnvException ;
@@ -92,6 +93,23 @@ public function searchUser(Request $request)
9293 return view ('panel/users ' , $ data );
9394 }
9495
96+ // Send test mail
97+ public function SendTestMail (Request $ request )
98+ {
99+ try {
100+ $ userId = auth ()->id ();
101+ $ user = User::findOrFail ($ userId );
102+
103+ Mail::send ('auth.test ' , ['user ' => $ user ], function ($ message ) use ($ user ) {
104+ $ message ->to ($ user ->email )
105+ ->subject ('Test Email ' );
106+ });
107+
108+ return redirect ()->route ('showConfig ' )->with ('success ' , 'Test email sent successfully! ' );
109+ } catch (\Exception $ e ) {
110+ return redirect ()->route ('showConfig ' )->with ('fail ' , 'Failed to send test email. Please try again later. ' );
111+ }
112+ }
95113
96114 //Block user
97115 public function blockUser (request $ request )
Original file line number Diff line number Diff line change 1+ <x-guest-layout >
2+ <div class =" mb-4 text-sm text-gray-600" >
3+ {{ __ (' Test E-Mail' ) } }
4+ </div >
5+ <br ><br >
6+ </x-guest-layout >
Original file line number Diff line number Diff line change @@ -380,6 +380,20 @@ function text($key){
380380</div >
381381<button type =" submit" class =" mt-3 ml-3 btn btn-info" >Apply changes</button >
382382</form >
383+
384+ <div class =" form-group col-lg-8" >
385+ <br ><br ><h5 >Test E-Mail setup:</h5 >
386+ @if (session (' success' ) )
387+ <div class =" alert alert-success" >
388+ {{ session (' success' ) } }
389+ </div >
390+ @elseif (session (' fail' ) )
391+ <div class =" alert alert-danger" >
392+ {{ session (' fail' ) } }
393+ </div >
394+ @endif
395+ </div >
396+ <a href =" {{ route (' SendTestMail' )} }" ><button class =" mt-3 ml-3 btn btn-outline-secondary" >Send Test E-Mail</button ></a >
383397{{-- end SMTP settings --}}
384398
385399
Original file line number Diff line number Diff line change 173173 Route::get ('/update/theme ' , [AdminController::class, 'updateThemes ' ])->name ('updateThemes ' );
174174 Route::get ('/panel/config ' , [AdminController::class, 'showConfig ' ])->name ('showConfig ' );
175175 Route::post ('/panel/config ' , [AdminController::class, 'editConfig ' ])->name ('editConfig ' );
176+ Route::get ('/send-test-email ' , [AdminController::class, 'SendTestMail ' ])->name ('SendTestMail ' );
176177 Route::get ('/theme-updater ' , function () {return view ('studio/theme-updater ' , []);});
177178 Route::get ('/update ' , function () {return view ('update ' , []);});
178179 Route::get ('/backup ' , function () {return view ('backup ' , []);});
You can’t perform that action at this time.
0 commit comments