This project is read-only.

Error on fetching body part data

May 5, 2009 at 8:45 AM
Edited May 5, 2009 at 8:46 AM
When i call method FetchBodyPart, ImapMessageBodyPart.Data property must return base 64 string but return base64 string with end string like this: "KizAAAAAA== FLAGS (\\Seen)"

So if you want get ImapMessageBodyPart.DataBinary then method Convert.FromBase64String throw an exception.

You must correct get accessor of property "DataBinary" to: return Convert.FromBase64String(_data.Replace(" FLAGS (\\Seen)",""));
May 5, 2009 at 9:06 AM
Edited May 5, 2009 at 9:06 AM
Fixed code:

public byte[] DataBinary
        {
            get
            {
                int flagsIndex = _data.IndexOf("FLAGS");
                byte[] binData = null;
                if (flagsIndex >= 0)
                {
                    binData = Convert.FromBase64String(_data.Substring(0, flagsIndex));
                }
                else
                {
                    binData = Convert.FromBase64String(_data);
                }
                return binData ;
            
            }
        }