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

how to attach a QImage in the mail through the SimpleMail?

xc233 opened this issue · comments

commented

When I add a image, I found it only can receive a QFile pointer. I have a QImage object now, how can I convert the QImage to QFile? I don't want to save the QImage to local disk because it's an async opeartion and then I need to delete the file. Thanks.

Save the Image to a QBuffer and set it's pointer there

Actually you can't set it's pointer as it expects a QFile, so you must get the bytearray from the QBuffer