cutelyst / simple-mail

An SMTP library written in C++ for Qt. Allows applications to send emails (MIME with text, html, attachments, inline files, etc.) via SMTP. Supports SSL and SMTP authentication.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sending files using QFile in async mode

DavidKelleySCSC opened this issue · comments

When adding a file as a mime part it looks like the QFile is expected to be on the heap to persist beyond the caller lifetime. Okay, so far so good, that is easy to do. So I call it with a fragment like:

    QFile* file = new QFile(filePath);
    if (!file->exists()) return(false);
    SimpleMail::MimeFile* mimeFile = new SimpleMail::MimeFile(file);
    pMessage->addPart(mimeFile );

But I cannot find that the SimpleMail::MimeFile object takes ownership or ever calls a delete on the QFile object. Am I missing something? Or, if disposing of the QFile object remains the callers concern, when it is safe to do so? (Say after a return from server->sendMail(*pMessage) )?

And I have really come to appreciate how well designed your Server class is now that we have moved away from the demo1~4 code with its blocking approach.

Yes I see it now, did not trace QFile back far enough. Will close.