diff --git a/src/services/mailservice.cpp b/src/services/mailservice.cpp index 67b3bdc..7a87f06 100644 --- a/src/services/mailservice.cpp +++ b/src/services/mailservice.cpp @@ -62,6 +62,14 @@ void MailService::fetchMails(const QString &accountId, const QString &folderId) return; } + + // Initialize synchronizer with account details before using it + if (!sync->initialize(*acc)) { + emit mailFetchError(accountId, folderId, tr("Failed to initialize synchronizer")); + sync->deleteLater(); + return; + } + // Connect progress signals (if they exist) using string-based syntax for compatibility QObject::connect(sync, SIGNAL(progressChanged(int)), this, SIGNAL(progressChanged(int)), Qt::QueuedConnection); QObject::connect(sync, SIGNAL(statusMessage(const QString&)), this, SIGNAL(statusMessage(const QString&)), Qt::QueuedConnection);