Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IMAP responses repeating

Tags:

c#

imap

Can somebody explain IMAP server responses behavior? When I send single command, response meets expectations:

C: A0001 FETCH 10 (BODY[HEADER.FIELDS (SUBJECT)])
S: * 10 FETCH (BODY[HEADER.FIELDS (SUBJECT)] {21}
   Subject: FW: test

   )
   A0001 OK FETCH completed.

But if I send several command one by one, responses behavior is unclear:

C: A0001 FETCH 10 (BODY[HEADER])
S: * 10 FETCH (BODY[HEADER] {1632}
   ...
   A0001 OK FETCH completed.
C: A0002 FETCH 10 (BODY[HEADER.FIELDS (SUBJECT)])
S: * 10 FETCH (BODY[HEADER] {1632}
   ...
   A0001 OK FETCH completed.
C: A0003 FETCH 10 BODY[TEXT]
S: * 10 FETCH (BODY[HEADER.FIELDS (SUBJECT)] {21}
   Subject: FW: test

   )
   A0002 OK FETCH completed.

Why are the responses repeated? And how to fix it? Code

like image 784
shmnff Avatar asked Nov 18 '25 09:11

shmnff


1 Answers

The problem was that writing to the ssl stream occurred in a read loop from the ssl stream.

like image 61
shmnff Avatar answered Nov 20 '25 22:11

shmnff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!