Reputation: 1113
I have a problem with function TIdIMAP4.ListSubscribedMailBoxes(AMailBoxList: TStrings): Boolean;
with this implementation :
function TIdIMAP4.ListSubscribedMailBoxes(AMailBoxList: TStrings): Boolean;
begin
{CC2: This is one of the few cases where the server can return only "OK completed"
meaning that the user has no subscribed mailboxes.}
Result := False;
CheckConnectionState([csAuthenticated, csSelected]);
SendCmd(NewCmdCounter, IMAP4Commands[cmdLSub] + ' "" *',
[IMAP4Commands[cmdList], IMAP4Commands[cmdLSub]]); {Do not Localize}
if LastCmdResult.Code = IMAP_OK then begin
// ds - fixed bug # 506026
ParseLSubResult(AMailBoxList, LastCmdResult.Text);
Result := True;
end;
end;
When I debug I see that the LastCmdResult.Text
stringlist is empty, but the LastCmdResult.FormattedReply
stringlist has all folders on my email server (Inbox, Sent, Trash, ...). When I tried to use LastCmdResult.FormattedReply
count or text, it had immediately lost its data and gave LastCmdResult.FormattedReply.Count=0
and LastCmdResult.FormattedReply.Text=''
. So I'd like to know if there is a way to enter the data inside LastCmdResult.FormattedReply
and get my email server folders or there is another way to solve my problem ?
Upvotes: 2
Views: 329
Reputation: 596352
I have a problem with function
TIdIMAP4.ListSubscribedMailBoxes(AMailBoxList: TStrings): Boolean;
with this implementation :
Works fine for me when I try it using the latest SVN version of Indy.
When I debug I see that the
LastCmdResult.Text
stringlist is empty, but theLastCmdResult.FormattedReply
stringlist has all folders on my email server (Inbox, Sent, Trash, ...).
When I run it, the opposite happens. LastCmdResult.Text
contains the expected text, and LastCmdResult.FFormattedReply
is empty (notice I mention the FFormattedReply
data member directly, see below).
When I tried to use
LastCmdResult.FormattedReply
count or text, it had immediately lost its data and gaveLastCmdResult.FormattedReply.Count=0
andLastCmdResult.FormattedReply.Text=''
.
That is by design. The FormattedReply
property is intended to be used by a client to parse a server reply so it can populate TIdReply
's property values, and to be used by a server to generate a new reply using TIdReply's property values. So, you cannot read from the FormattedReply
property on the client side.
So I'd like to know if there is a way to enter the data inside
LastCmdResult.FormattedReply
and get my email server folders or there is another way to solve my problem ?
The whole purpose of ListSubscribedMailBoxes()
is to return the folder names in the AMailBoxList
parameter. If that is not working for you, then either
you are using a older/buggy version of Indy.
your server is sending the data in a format that TIdIMAP4 is not able to parse.
Without knowing which version of Indy you are actually using, or what the server's reply data actually looks like, there is no way to diagnose your issue one way or the other.
Upvotes: 2