We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

IMAP FetchMessage without ListMessages

If I use FetchMessage with ListMessages collection, everything works fine.
However, I need to access the message sometimes directly.
For example, I download a local copy, but without the attachments.
I save the UniqueURI and MessageID, so I can retrieve these attachments later.
However, trying to call the FetchMessage directly gives me an error:
AE_26_1_0004 BAD Command received in Invalid state.

I believe this works fine for exchange, but I cannot get this to work with IMAP.
code is below where ID is the Unique ID from original listmessages call
any suggestions?

Private Function GetIMAPMessage(strID As String) As MailMessage
    Dim msg As MailMessage = Nothing
        Dim client As ImapClient = LoginIMAPCredential()

        If client Is Nothing Then
            Return Nothing
        End If

        msg = client.FetchMessage(strID)

    Catch ex As Exception

    End Try

    Return msg
End Function


Please select the folder containing the message before calling FetchMessage(UniqueID). The sample code snippet is given below.

msg = imapClient.FetchMessage(UniqueId)

We hope that this solved the issue that you were facing. Please feel free to reach us if additional information is required.

Perfect, thank you.