Detect Mboxo vs Mboxrd

Hello,
When loading Mbox, how to distinguish if it’s Mboxrd or Mboxo? (not by possible extension, but by content) any method for that?

@australian.dev.nerds

We have logged this requirement in our issue tracking system as EMAILNET-40824. We will inform you once there is an update available on it.

1 Like

Hi, the reason is on loading mbox, when to use Mboxo and when to use Mboxrd reader?
*DetectFileFormat does not distinguish it.

@australian.dev.nerds

We have logged your concerns in our issue tracking system. We will inform you once this issue is resolved.

@australian.dev.nerds

You can use CreateReader method to create a reader. It automatically detects the format (Mboxo or Mboxrd) and creates an object of the corresponding class (MboxoStorageReader or MboxrdStorageReader).

Dim reader = MboxStorageReader.CreateReader("my.mbox", New MboxLoadOptions()) 

For Each eml In reader.EnumerateMessages()

' do something 
Next
1 Like

Thanks so much, very helpful, however, it’s done internally, how can I detect the sub-format of mbox?
DetectFileFormat will return .mbox for all 4 variants, and also the above code, since mbox CL/CL2 is not supported, it’s better to be able to detect them at least!

I think adding this to DetectFileFormat so it will return MboxRD/MboxCL/MboxCL2 will not be accepted since they’re sub-formats, but another way available?
Best

@australian.dev.nerds

The CreateReader automatically detect the formats. Could you please share the complete detail of your use case in which you want to identify MboxRD/MboxCL/MboxCL2? Thanks for your cooperation.

Hello,
Mostly need to distinguish between MboxO and MboxRd (which is supported by Aspose) but would be nice to detect all 4 formats (not adding support for reading those remaining 2, but just detect their inner format)
Although AFAIK to detect the internal format, the difference would be their separator.

Anyway, as you said, the CreateReader automatically detect the formats (MboxO vs MboxRd)
So, it seems as easy as ABC to add a property to show it to user.
Like .MboxFormat
With Enum:
MboxFormat.MboxO
MboxFormat.MboxRD
MboxFormat.MboxCL
MboxFormat.MboxCL2

Or, if you find it useless, please kindly advise if there’s a workaround to detect it?
Thanks, I’d appreciate it :slight_smile:

@australian.dev.nerds,

I agree, it’s a useful feature. Created a ticket. Thanks.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

  Issue ID(s): EMAILNET-40907

You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hi,
Please advise if mbox version can be detected now :slight_smile:

@australian.dev.nerds,

The ticket is still open, so the feature hasn’t been added yet. But you can use the following way:

MboxStorageReader reader = MboxStorageReader.CreateReader(stream, new MboxLoadOptions());

if (reader is MboxrdStorageReader)
{
    // it is mboxrd
 }
else if(reader is MboxoStorageReader)
{
    //  it is mboxo
}

Thanks.

1 Like

Thanks, great solution, and one more final else at the end of code means mbox Cl or Cl2

@australian.dev.nerds,

else at the end of code means mbox Cl or Cl2

Aspose.Email does not distinguish between mboxcl and mboxcl2, and it does not use content length to read mbox.

The MBOXCL and MBOXCL2 are not supported by Aspose.Email explicitly because they are not so widely used.

In practice, it is possible to read MBOXCL and MBOXCL2 using MboxStorageReader, but it will handle a “From” line as message separator instead of a “Content-Length”.