simple-mail icon indicating copy to clipboard operation
simple-mail copied to clipboard

Async-Problem and possible fix

Open ix07 opened this issue 3 years ago • 2 comments

Hi.

First of all - thank you for making "simple-mail".

We experienced some problems with the async-version (the sync version worked without that problem!) and a colleague of mine investigated. He said that he was able to fix the problem by adding a line containing "\r\n.\r\n" to a mime-part.

The RFC specification seems to confirm that a mail must be terminated like that.

https://www.rfc-editor.org/rfc/rfc5321#section-4.5.2

I didn't work on the problem myself and don't know much about SMTP, so sorry for being a little vague on details (if necessary I can ask for more information). But I thought I should at least bring this to your attention.

Attached to this file you will find a patch file.

Thanks.

simplemail_patch.txt

ix07 avatar Aug 25 '22 11:08 ix07

Thanks ix07. I applied the patch but the async code still does nothing. Any ideas what might be wrong?

joshorenberg avatar Sep 06 '22 23:09 joshorenberg

Hi.

I confirm the issue (mail not send due to missing "\r\n.\r\n" to finish the data of a DATA command).

Nevertheless i think we may not change the write method of MimeMultipart (since it is used in the sync version too), or SenderPrivate::sendMail as to be modified too (too avoid the second dot line).

Another (not really beautiful) solution should be to add the dot line in the lambda function of ServerPrivate::createSocket(), line 293 of server.cpp :

- if (cont.msg.write(socket)) {
+ if (cont.msg.write(socket) && socket->write((QByteArrayLiteral("\r\n.\r\n")))) {

RaphGava avatar Sep 13 '22 14:09 RaphGava

MR that fixes this was merged

dantti avatar Oct 26 '23 19:10 dantti