IMAP client and e-mail document parser for C++ Qt5

partysan e0127aac56 fix in moment vor 1 Jahr
CurlHandle.cpp 8c43392a07 Implementation vor 1 Jahr
CurlHandle.h 8c43392a07 Implementation vor 1 Jahr
IMAPClient.cpp 8c43392a07 Implementation vor 1 Jahr
IMAPClient.h 8c43392a07 Implementation vor 1 Jahr
LICENSE 19eb759e65 Initial commit vor 1 Jahr
MAILClient.cpp e0127aac56 fix in moment vor 1 Jahr
MAILClient.h 8c43392a07 Implementation vor 1 Jahr
README.md 00ecf14212 Update README.md vor 1 Jahr
emaildocument.cpp 8c43392a07 Implementation vor 1 Jahr
emaildocument.h 8c43392a07 Implementation vor 1 Jahr
emaildocumententry.cpp 8c43392a07 Implementation vor 1 Jahr
emaildocumententry.h 8c43392a07 Implementation vor 1 Jahr
qtimapclient.cpp e0127aac56 fix in moment vor 1 Jahr
qtimapclient.h 8c43392a07 Implementation vor 1 Jahr

README.md

QtEmailFetcher

IMAP client and e-mail document parser for C++ Qt5.

Dependenсies: libcurl, Qt.

A little example which will fetch all your unreaded messages with short summary:

#include "qtimapclient.h"
#include <QDebug>
#include <QThread>

int main() 
{
    QtImapClient imap;
    imap.setConnectionType(QtImapClient::ConnectionType::SSL);
    imap.setHostname("imap.server.com");
    imap.setPort(993);
    imap.setUsername("yournick@server.com");
    imap.setPassword("IHateTheC++");
    
    QList<unsigned int> unreaded;
    if (not imap.checkUnseen(unreaded))
    {
        qInfo() << "Fetch failed:" << imap.errorString();
        return 1;
    }
    qInfo() << "Unreaded emails:" << unreaded;
    
    for (const auto& un: unreaded)
    {
        qInfo().noquote() << "\nFetching:" << un;
        
        auto email = imap.fetch(un);
        if (email == nullptr)
        {
            qInfo() << "Hmmm. Email is nullptr...";
            continue;
        }
        
        qInfo() << email->from().address << email->from().name;
        qInfo() << email->subject();
        qInfo() << email->dateTime();
        qInfo() << "Payload size:" << email->payload().size();
        
        for (const auto& part: email->payload())
        {
            qInfo() << part->contentType().string << part->content().size();
        }
        
        QThread::sleep(2);
    }
    return 0;
}