Frequently Asked Questions
Licensing & Open Source
What is the licensing model for Aspose.Email FOSS for .NET?
Aspose.Email FOSS for .NET is released under the MIT License. You can use it in personal, commercial, and open-source projects without restriction. No runtime licence key or activation is required.
Can I use Aspose.Email FOSS for .NET in a commercial product?
Yes. The MIT License permits unrestricted commercial use. No royalty payment, licence server, or internet connection is required at runtime.
Installation & Requirements
How do I install Aspose.Email FOSS for .NET?
Install the package using the .NET CLI command below:
dotnet add package Aspose.Email.FossAdd the namespace declaration to each source file that uses the API:
using Aspose.Email.Foss.Msg;What .NET version is required?
.NET 8.0 or later. The library does not support .NET Framework or .NET Standard. It is pure managed C# with no native dependencies and runs identically on Windows, Linux, macOS, Docker, and serverless environments.
Format Support
Which email formats are supported?
| Format | Read | Write |
|---|---|---|
| MSG (Outlook MAPI) | Yes | Yes |
| CFB (Compound File Binary) | Yes | Yes |
| EML (MIME / RFC 5322) | Yes | Yes |
Can I read EML files?
Yes. Use MapiMessage.LoadFromEml(stream) to load a standard .eml file. The built-in
MIME parser handles folded headers, base64 content, and multipart messages.
Can I convert MSG to EML?
Yes. Call message.SaveToEml() for in-memory byte[] output, or
message.SaveToEml(stream) to write to a stream. Subject, body, HTML body, sender,
recipients, and attachments are preserved.
Is TNEF (winmail.dat) supported?
No. Only the standard MSG (CFB) and EML (MIME) formats are supported.
Is IMAP, SMTP, or POP3 supported?
No. The library handles MSG and EML files directly and does not include any network or protocol layer.
API Usage
How do I load an MSG file?
Open a file stream and pass it to MapiMessage.FromStream() to load the message into memory:
using Aspose.Email.Foss.Msg;
using var stream = File.OpenRead("message.msg");
var message = MapiMessage.FromStream(stream);
Console.WriteLine(message.Subject);How do I create and save a new message?
Call MapiMessage.Create() with subject and body strings, add recipients, then call Save() with a file path:
var message = MapiMessage.Create("Subject", "Body");
message.SenderEmailAddress = "alice@example.com";
message.AddRecipient("bob@example.com", "Bob");
message.Save("output.msg");How do I add attachments to a message?
Call AddAttachment() with the filename, data source (byte array or stream), and MIME type string:
// From a byte array
message.AddAttachment("file.pdf", pdfBytes, "application/pdf");
// From a stream
using var stream = File.OpenRead("photo.png");
message.AddAttachment("photo.png", stream, "image/png");How do I convert an EML file to MSG?
Open the EML file as a stream and pass it to MapiMessage.LoadFromEml(), then call Save() to write the result as MSG:
using var eml = File.OpenRead("message.eml");
var message = MapiMessage.LoadFromEml(eml);
message.Save("message.msg");How do I access the raw CFB structure?
Use CfbReader.FromFile() to open the CFB container and iterate its directory entries with IterChildren():
using Aspose.Email.Foss.Cfb;
using var reader = CfbReader.FromFile("message.msg");
foreach (var entry in reader.IterChildren(CfbConstants.RootStreamId))
Console.WriteLine(entry.Name);Known Limitations
Are there calendar or appointment APIs?
The library handles MSG files generically. Calendar-specific properties can be accessed via
SetProperty() / GetPropertyValue() with MAPI property IDs from
CommonMessagePropertyId, but there is no dedicated calendar or appointment API.
Is thread safety guaranteed?
Each MapiMessage and CfbReader instance is independent. Concurrent access to separate
instances from separate threads is safe. Do not share a single instance across threads
without external synchronisation.