bluetiger9 / SmtpClient-for-Qt

An SMTP Client writen in C++ for Qt. Allows applications to send emails (MIME with text, html, attachments, inline files, etc.) via SMTP. Supports SSL and SMTP authentication.
https://github.com/bluetiger9/SmtpClient-for-Qt/wiki
GNU Lesser General Public License v2.1
456 stars 228 forks source link

is there any demo shows that SendEmail in another thread? #89

Closed opengpu closed 2 years ago

opengpu commented 5 years ago

is there any demo shows that SendEmail in another thread?

xeco23 commented 5 years ago

If you create SmtpClient instance in another thread and try to send email in that thread, it works. Otherwise, it doesn't because some QSslSocket signaling thread issues that I cannot remember.

bluetiger9 commented 2 years ago

Doing all the interaction with a SmtpClient from the same thread should work. This includes creating the object, and calling the connectToHost(), login(), sendMail(), quit() and waitFor...() method from the same thread.

So, to delegate email sending to a different thread, I would recommend moving all interactions to a new thread. Calling just the sendMail() may not work reliably.