How to import pst file to Thunderbird directly?

Hi, I want to import the PST file directly into Thunderbird. I read this article

to understand how to write messages in thunderbird. But didn’t understand the process. Can you please provide a code for this?

  1. Same with Zimbra TGZ:

I also want to save PST to Zimbra TGZ format. Does Aspose support it?

@rdnics

We have logged your requirement in our issue tracking system as EMAILNET-40748. We will inform you once there is an update available on it. We apologize for your inconvenience.

@rdnics

Aspose.Email has support for converting from PST to MBOX. Please check tthe MailboxConverter class.

Code example

using var pst = PersonalStorage.FromFile(@"some.pst");
// The mbox files will be created in the directory at the specified path. 
// A separate mbox file will be created for each folder in the pst.
MailboxConverter.ConvertPersonalStorageToMbox(pst, @"D:\out", null);

Also, you can create custom code to convert messages from PST to MBOX.
The following shows how to convert messages from the inbox PST folder to MBOX.

using var pst = PersonalStorage.FromFile(@"some.pst");
var inbox = pst.GetPredefinedFolder(StandardIpmFolder.Inbox);

if (inbox != null)
{
    using var mbox = new MboxrdStorageWriter(@"D:\test.mbox", false);
    MailConversionOptions options = new MailConversionOptions();

    foreach (var msg in inbox.EnumerateMapiMessages())
    {
	    Console.Writeline(msg.Subject);
        mbox.WriteMessage(msg.ToMailMessage(options));
    }
}

As for converting from PST to TGZ, Aspose.Email does not support this. But you can save messages to a directory, and use Aspose.Zip to create TGZ archive from the directory with messages.

Below is a sample code for saving messages from the PST inbox folder to a separate directory.

using var pst = PersonalStorage.FromFile(@"some.pst");
var inbox = pst.GetPredefinedFolder(StandardIpmFolder.Inbox);

var dir = Directory.CreateDirectory(@"D:\Inbox");

if (inbox != null)
{
    foreach (var msg in inbox.EnumerateMapiMessages())
    {
        Console.WriteLine(msg.Subject);
        msg.Save(Path.Combine(dir.FullName, $"{GetValidName(msg.Subject)}.eml"), SaveOptions.DefaultEml);
    }
}