public void CopyMessage(string sUid, string sFolderName)
{
ImapResponseEnum eImapResponse = ImapResponseEnum.IMAP_SUCCESS_RESPONSE;
if (String.IsNullOrEmpty(sFolderName))
{
throw new ImapException(ImapException.ImapErrorEnum.IMAP_ERR_INVALIDPARAM, "Invalid folder name.");
}
if (String.IsNullOrEmpty(sUid))
{
throw new ImapException(ImapException.ImapErrorEnum.IMAP_ERR_INVALIDPARAM, "Invalid uid");
}
if (!m_bIsLoggedIn)
{
try
{
Restore(false);
}
catch (ImapException e)
{
if (e.Type != ImapException.ImapErrorEnum.IMAP_ERR_INSUFFICIENT_DATA)
throw e;
throw new ImapException(ImapException.ImapErrorEnum.IMAP_ERR_NOTCONNECTED);
}
}
if (!m_bIsFolderSelected && !m_bIsFolderExamined)
{
throw new ImapException(ImapException.ImapErrorEnum.IMAP_ERR_NOTSELECTED);
}
ArrayList asResultArray = new ArrayList();
string sCommand = IMAP_UIDCOPY_COMMAND;
sCommand += " " + sUid + " " + sFolderName + IMAP_COMMAND_EOL;
try
{
eImapResponse = SendAndReceive(sCommand, ref asResultArray);
if (eImapResponse != ImapResponseEnum.IMAP_SUCCESS_RESPONSE)
{
throw new ImapException(ImapException.ImapErrorEnum.IMAP_ERR_SEARCH, asResultArray[0].ToString());
}
}
catch (Exception e)
{
throw e;
}
}