Archived Forum Post

Index of archived forum posts

Question:

[C++] Error using Imap.Copy

Nov 21 '14 at 04:36

I'm trying to move an email between Mailboxes, but am getting an error but not sure how to resolve?

if (imap.Copy (uid,true,sMailbox) == true)

where uid contains a valid uid and sMailbox contains a mailbox name checked to exist.

ChilkatLog:
    Copy(15ms):
        DllDate: Oct  1 2014
        ChilkatVersion: 9.5.0.44
        UnlockPrefix: *********
        Username: CBDCCTX05:adam.dempsey
        Architecture: Little Endian; 32-bit
        Language: Visual C++ 8.0 (32-bit)
        VerboseLogging: 1
        Not in the selected state
    --Copy
--ChilkatLog

Not sure what 'Not in the selected state' means?


Accepted Answer

Make sure to read the online reference documentation for the Copy method:

bool Copy(int msgId, bool bUid, const char *copyToMailbox);

Copies a message from the selected mailbox to copyToMailbox...

You need to select the source mailbox. The "Not in the selected state" means you are connected and authenticated with an IMAP server, but you have no mailbox selected..