Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TIdIMAP4.SendCmd
#2
(07-11-2018, 04:22 AM)Boba TC Wrote:
Code:
C5 SEARCH SINCE  8-JUL-2018<EOL>
C5 BAD Could not parse command<EOL>

The date string has a space char instead of a '0' char in front of the '8', it should be like this instead:

Code:
C5 SEARCH SINCE 08-JUL-2018

You must be using a VERY old version of Indy, because that problem was fixed a LONG time ago (back around 2010). Please upgrade to a modern version of Indy.

If that is not an option for you, then yes, you will have to send the command manually (note that some of the needed functionality is not public), for example:

Code:
class TIdIMAP4Access : public TIdIMAP4
{
public:
    inline void CheckIfState(TIdIMAP4ConnectionState AState) { TIdIMAP4::CheckConnectionState(AState); }
    inline void ParseSearch(TIdMailBox *AMailBox, TStrings *ADetails) { TIdIMAP4::ParseSearchResult(AMailBox, ADetails); }
};

...

TDateTime dtDate = TDateTime::CurrentDate() - 2;

Word wYear, wMonth, wDay;
dtDate.DecodeDate(&wYear, &wMonth, &wDay);

String Cmd = _D("SEARCH SINCE ") + Format(_D("%.2d-%s-%.4d"), ARRAYOFCONST(( wDay, monthnames[wMonth-1].UpperCase(), wYear )) );

((TIdIMAP4Access*)IdIMAP4)->CheckIfState(csSelected);
if (IdIMAP4->SendCmd(Cmd, OPENARRAY(String, (_D("SEARCH"), _D("UID")))) == IMAP_OK)
{
    ((TIdIMAP4Access*)IdIMAP4)->ParseSearch(IdIMAP4->MailBox, IdIMAP4->LastCmdResult->Text);
    // use IdIMAP4->MailBox->SearchResults as needed...
}

Reply


Messages In This Thread
TIdIMAP4.SendCmd - by Boba TC - 07-11-2018, 04:22 AM
RE: TIdIMAP4.SendCmd - by rlebeau - 07-11-2018, 07:46 PM
RE: TIdIMAP4.SendCmd - by Boba TC - 07-18-2018, 02:27 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)