03-06-2023, 10:29 PM
I use the IMAP system to dowload an email.
MSG: TIdMessage;
IMAP: TIdIMAP4;
I then call IMAP.UIDRetrieve(IntToStr(IMAP.MailBox.SearchResult[i]), MSG);
I can now read all fields like From, Subject etc. fine.
Then the entire email is loaded into a Stream using
IMAP.UIDRetrieveNoDecodeToStream(IntToStr(IMAP.MailBox.SearchResult[i]), AStream);
This Stream is then saved to file, as an .eml file.
I can load this file with an email program fine, all data complete.
The same Stream is internally kept.
But when I afterwards use an IdMessage.LoadFromStream, all fields like From, Subject, etc. are all empty.
The LoadFromStream does not seem to initialize the fields.
It seems only the IMAP does this, during the call to IMAP.UIDRetrieve.
How do I get my data back in the TIdMessage after a LoadFromStream?
MSG: TIdMessage;
IMAP: TIdIMAP4;
I then call IMAP.UIDRetrieve(IntToStr(IMAP.MailBox.SearchResult[i]), MSG);
I can now read all fields like From, Subject etc. fine.
Then the entire email is loaded into a Stream using
IMAP.UIDRetrieveNoDecodeToStream(IntToStr(IMAP.MailBox.SearchResult[i]), AStream);
This Stream is then saved to file, as an .eml file.
I can load this file with an email program fine, all data complete.
The same Stream is internally kept.
But when I afterwards use an IdMessage.LoadFromStream, all fields like From, Subject, etc. are all empty.
The LoadFromStream does not seem to initialize the fields.
It seems only the IMAP does this, during the call to IMAP.UIDRetrieve.
How do I get my data back in the TIdMessage after a LoadFromStream?

