login about faq

Hi!

I try using the SetMailFlag method to delete a specific mail from my inbox but it doesn't work. I get the following error message from the set SetMailFlag method:

ChilkatLog:
  SetMailFlag:
    DllDate: Aug  5 2012
    UnlockPrefix: Anything for 30-day trial
    Username: SELND39C29X0:SEDAVFRE
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    No ckx-imap-uid header field.
  --SetMailFlag
--ChilkatLog

Here is my code. EmailId is a variable with the uid fetched from the mailbox at an earlier stage.

Public Sub DeleteMail(EmailId) Dim Imap As New ChilkatImap Dim Email

Imap.UnlockComponent ("Anything for 30-day trial") Imap.Ssl = 1 Imap.Port = 993

Imap.Connect "imapserver..."
Imap.Login "login...", "pass..."
Imap.SelectMailbox "Inbox"

Set Email = Imap.FetchSingle(EmailId, 1)

debug.print Imap.SetMailFlag(Email, "Deleted", 1)
debug.print Imap.LastErrorText
debug.print Imap.Expunge
debug.print Imap.LastErrorText

Imap.Disconnect

Set Imap = Nothing

End Sub

asked Nov 08 '12 at 08:58

David%20Fredriksson's gravatar image

David Fredriksson
1111

edited Nov 08 '12 at 10:51

chilkat's gravatar image

chilkat ♦♦
11.8k316358420


When emails are downloaded in other ways, such as by calling FetchBundle, where multiple emails are returned, Chilkat adds the ckx-imap-uid header so that an application can know the email's UID on the server.

The FetchSingle method call has two arguments: the first is a UID or sequence number, and the second is a boolean (which is 0/1 for the ActiveX) that indicates whether the 1st argument is a UID or sequence number. Given that the application already knows the UID, it can call the SetFlag method directly. The arguments for SetFlag are, in VBScript/ActiveX terms are shown below (see the online reference documentation for more information).

SetFlag(msgId As Long, bUid As Long, flagName As String, value As Long) As Long

The purpose of the SetMailFlag method is to allow an application to indirectly specify the UID via the email object, assuming the email object contains the ckx-imap-uid header. The application does not need to trouble itself with extracting the value of the ckx-imap-uid header and then interpret the value and pass the correct value to SetFlag.

In summary: The solution is to call SetFlag instead, passing the already-known UID to that method. To prevent this pitfall from happening in the future, I'm going to modify FetchSingle so that it adds the ckx-imap-uid header anyway. This will be a feature in the next version..

link

answered Nov 08 '12 at 11:11

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×175
×13

Asked: Nov 08 '12 at 08:58

Seen: 1,515 times

Last updated: Nov 08 '12 at 11:11

powered by OSQA