Click here to Skip to main content
13,052,022 members (63,269 online)
Rate this:
Please Sign up or sign in to vote.
Hey guys,
I was wondering what possible scenarios could cause a QUIT (POP3)command to fail? and if it failed to quit, what would be the side effects? for example, does it cause problems with new connection trying to read mails?
Posted 28-Mar-12 5:25am
Updated 28-Mar-12 5:56am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

See RFC 1939[^].

The reason of the failure is usually send with the -ERR response.

The QUIT command may fail if the server can't delete messages that has been marked for deletion with the DELE command. You must assume that no or not all marked messages has been deleted. A new connection should be established without problems.

The QUIT command may also fail if the connection has not been established before (a prior login command returned with an error).
soby 28-Mar-12 15:21pm
From looking at the code it looks like when the QUIT fails there is no response returned or it does not start with '+OK'. I was wondering when could we get the no response situation?

if (response== NULL || _strnicmp(response, "+OK", 3) != 0)
fail = 1;

BTW, when you say "usually" the reason of failur is sent, could you explain what would happen in the rest of the cases in which no -ERR is sent?
Jochen Arndt 29-Mar-12 3:05am
Your code snippet checks only if the begin of the response string is +OK. If not, an error is assumed. In case of errors it would be helpful to see the complete response string (if not null).

According to the RFC, each command response must begin with +OK or -ERR. Additional describing text is optional. But most server implementations will send additional text. The connect answer of the server usually contains the name and version of the server. You may try to find the source code of your server (many are open source) and analyse the code when receiving the QUIT command.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 28 Mar 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100