fix: log sendTestEmail errors and show error toast for 15s so it can be read

This commit is contained in:
Ghassan Yusuf 2026-05-26 16:31:45 +03:00
parent 9115bc9630
commit c6a12163bb
2 changed files with 2 additions and 1 deletions

View File

@ -84,6 +84,7 @@ class MailAccountController extends Controller
); );
return response()->json(['success' => true]); return response()->json(['success' => true]);
} catch (\Exception $e) { } catch (\Exception $e) {
\Illuminate\Support\Facades\Log::error('sendTestEmail failed: ' . $e->getMessage(), ['account' => $mailAccount->name]);
return response()->json(['success' => false, 'message' => $e->getMessage()]); return response()->json(['success' => false, 'message' => $e->getMessage()]);
} }
} }

View File

@ -705,7 +705,7 @@ function sendTestEmail() {
showToast('Test email sent!', 'success'); showToast('Test email sent!', 'success');
} else { } else {
statusEl.textContent = 'Failed.'; statusEl.style.color = '#dc2626'; statusEl.textContent = 'Failed.'; statusEl.style.color = '#dc2626';
showToast(data.message || 'Failed to send.', 'error'); showToast(data.message || 'Failed to send.', 'error', 15000);
} }
}).catch(function() { }).catch(function() {
statusEl.textContent = 'Request failed.'; statusEl.style.color = '#dc2626'; statusEl.textContent = 'Request failed.'; statusEl.style.color = '#dc2626';