How can I set a email message unread??
Here I read the emails from inbox in gmail
When I read gmail, it flag like read, so I would like to flag like unread again.
TheImap.GetUID(i+1, TheUID);
TheImap.UIDRetrieveFlags(TheUID, TheFlags);
TheImap.UIDRetrieveHeader(TheUID, TheMsg);
TheImap.UIDRetrieveText(TheUID, lacadena);
if mfSeen in TheFlags then begin
TheImap.StoreFlags(TheUID, sdReplace, TheMsg.Flags - [mfSeen] );
You are trying to pass a UID string where a MsgNum integer is expected. You need to use UIDStoreFlags()
instead of StoreFlags()
:
TheImap.UIDStoreFlags(TheUID, sdReplace, TheFlags - [mfSeen]);