Toast-Benachrichtigungen bei IMAP-Sync- und SMTP-Send-Fehlern

Bisher blieb ein fehlgeschlagener IMAP-Sync oder E-Mail-Versand still – der User
sah nur im Browser-Devtools, dass etwas schief lief. Jetzt erscheint eine rote
Toast-Benachrichtigung (8 Sekunden) mit der konkreten Fehlermeldung des Servers,
z.B. 'Sync fehlgeschlagen: IMAP-Authentifizierung fehlgeschlagen: NO [AUTHENTICATIONFAILED]'.

EmailClientTab (Synchronisieren-Button):
- toast.success bei erfolgreichem Sync
- toast.error bei Fehler + bei Backend-Response mit success=false

ComposeEmailModal (Senden):
- toast.success bei erfolgreichem Versand
- toast.error bei SMTP-Fehler mit Server-Response (zusätzlich zum Inline-Fehler)

Außerdem im imapService.testImapConnection:
- Roh-Error wird jetzt geloggt (code, response, responseStatus, authenticationFailed)
- ImapFlow-spezifische Felder werden in die Fehlermeldung übernommen, sodass
  z.B. '2 NO [AUTHENTICATIONFAILED] Authentication failed.' direkt sichtbar wird

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 15:16:04 +02:00
parent 620bc1bcd9
commit cfcdf088df
3 changed files with 56 additions and 4 deletions
+27
View File
@@ -297,9 +297,36 @@ export async function testImapConnection(credentials: ImapCredentials): Promise<
// Ignorieren
}
// Rohes Error-Objekt loggen, damit wir ImapFlow-spezifische Felder sehen
console.error('[testImapConnection] Raw error:', error);
if (error && typeof error === 'object') {
const e = error as any;
console.error('[testImapConnection] Details:', {
code: e.code,
response: e.response,
responseStatus: e.responseStatus,
responseText: e.responseText,
authenticationFailed: e.authenticationFailed,
serverResponseCode: e.serverResponseCode,
});
}
if (error instanceof Error) {
const msg = error.message.toLowerCase();
const errorCode = (error as NodeJS.ErrnoException).code?.toLowerCase() || '';
const e = error as any;
// ImapFlow-spezifische Details durchreichen wenn vorhanden
if (e.authenticationFailed) {
throw new Error(
`IMAP-Authentifizierung fehlgeschlagen${e.response ? `: ${e.response}` : ''}`,
);
}
if (e.response || e.responseText) {
throw new Error(
`IMAP ${e.responseStatus || 'Fehler'}: ${e.response || e.responseText}`,
);
}
if (msg.includes('authentication') || msg.includes('login')) {
throw new Error('IMAP-Authentifizierung fehlgeschlagen');