public static void Run()
{
// ExStart:CreateNewMessagesToThunderbird
// The path to the File directory.
string dataDir = RunExamples.GetDataDir_SMTP();
try
{
// Open the storage file with FileStream
FileStream stream = new FileStream(dataDir + "Please add your Thunderbird file name here", FileMode.Open, FileAccess.Read);
// Initialize MboxStorageWriter and pass the above stream to it
MboxrdStorageWriter writer = new MboxrdStorageWriter(stream, false);
// Prepare a new message using the MailMessage class
MailMessage message = new MailMessage("[email protected]", "[email protected]", "added 1 from Aspose.Email", "added from Aspose.Email");
// Add this message to storage
writer.WriteMessage(message);
// Close all related streams
writer.Dispose();
stream.Close();
// ExEnd:CreateNewMessagesToThunderbird
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nPlease add Thunderbird file name to the FileStream");
}
}
}