fix(mail) : le test de connexion fonctionne même si la config est désactivée + remonte l'erreur IMAP réelle

Le guard enabled dans getClient() bloquait le test de connexion alors que le
workflow naturel est configurer → tester → activer. getClient(requireEnabled)
permet au nouveau testConnection() de se connecter sans exiger enabled=true.
Le controller (ROLE_ADMIN) renvoie désormais le détail de l'erreur pour faciliter
le diagnostic.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-20 07:46:11 +02:00
parent 7a682b4662
commit f313e74c9e
3 changed files with 42 additions and 11 deletions

View File

@@ -11,6 +11,15 @@ use App\Mail\Exception\MailProviderException;
interface MailProviderInterface
{
/**
* Opens a connection using the stored configuration and returns the number
* of folders found. Used by the admin "test connection" endpoint, so it
* MUST work even when the configuration is not yet enabled.
*
* @throws MailProviderException
*/
public function testConnection(): int;
/**
* Returns the full folder tree of the configured mailbox.
*