Improve log error handling regarding notification sending for issue #17491

* when an error is generated when denying checkouts, there are not enough logs
to determine the problem from the email provider
* missing handling of log test mail config, there is none of logs cos there
is no log handling on test email, becouse all the results are just sent to
the http response and no log were writen.
This commit is contained in:
mckaygerhard
2025-08-08 12:15:05 -04:00
parent f4be5ffb5d
commit 0fdbdfd5c2
3 changed files with 9 additions and 3 deletions
@@ -150,11 +150,11 @@ class SettingsController extends Controller
if (!config('app.lock_passwords')) {
try {
Notification::send(Setting::first(), new MailTest());
Log::debug('Mail sending to '.config('mail.reply_to.address'));
Log::debug('Attempting to sending to '.config('mail.reply_to.address'));
return response()->json(['message' => 'Mail sent to '.config('mail.reply_to.address')], 200);
} catch (\Exception $e) {
Log::error('Mail sent error using '.config('mail.reply_to.address') .': '. $e->getMessage());
Log::debug($e);
Log::error('Mail sent to '.config('mail.reply_to.address') . $e->getMessage());
return response()->json(['message' => $e->getMessage()], 500);
}
}