diff --git a/src/Controller/Mail/MailTestConnectionController.php b/src/Controller/Mail/MailTestConnectionController.php new file mode 100644 index 0000000..eedee6a --- /dev/null +++ b/src/Controller/Mail/MailTestConnectionController.php @@ -0,0 +1,44 @@ +mailProvider->listFolders(); + + return $this->json([ + 'ok' => true, + 'foldersCount' => count($folders), + ]); + } catch (MailProviderException) { + return $this->json([ + 'ok' => false, + 'error' => 'Connexion IMAP impossible. Vérifiez la configuration.', + ]); + } catch (Throwable) { + return $this->json([ + 'ok' => false, + 'error' => 'Erreur inattendue lors du test de connexion.', + ]); + } + } +}