Getting Started
Getting Started with Aspose.Email FOSS for C++
Welcome to Aspose.Email FOSS for C++, a free, MIT-licensed C++ library for reading, creating, and writing Outlook MSG files and Compound File Binary (CFB) containers. This guide takes you from a fresh C++ project to working with MSG files in minutes.
Prerequisites
| Requirement | Detail |
|---|---|
| Compiler | C++17 or later (GCC 9+, Clang 10+, MSVC 2019+) |
| Build system | CMake 3.26 or later |
| OS | Windows, macOS, or Linux |
| Dependencies | None |
Installation
Clone the repository and add it as a CMake subdirectory:
git clone https://github.com/aspose-email-foss/Aspose.Email-FOSS-for-Cpp.gitIn your CMakeLists.txt:
add_subdirectory(Aspose.Email-FOSS-for-Cpp)
target_link_libraries(your_target PRIVATE AsposeEmailFoss::AsposeEmailFoss)Verify with a minimal program:
#include <iostream>
#include "aspose/email/foss/msg/mapi_message.hpp"
int main()
{
auto message = aspose::email::foss::msg::mapi_message::create("Test", "Hello");
std::cout << message.subject() << '\n';
// Output: Test
}See the Installation Guide for detailed project setup.
What You Can Do
Once set up you can immediately:
- Read MSG files with
mapi_message::from_stream()ormapi_message::from_file()— access subject, body, sender, recipients, and attachments - Create MSG messages from scratch with
mapi_message::create()— set all fields, add recipients and attachments, then serialize withsave() - Convert between MSG and EML with
load_from_eml()andsave_to_eml() - Inspect CFB binary containers with
cfb_reader— traverse storages and streams, resolve paths, read raw bytes - Write CFB documents with
cfb_writerfor forensic inspection or format construction
Quick Start
Read an MSG file and print its subject:
#include <fstream>
#include <iostream>
#include "aspose/email/foss/msg/mapi_message.hpp"
int main()
{
std::ifstream input("sample.msg", std::ios::binary);
auto message = aspose::email::foss::msg::mapi_message::from_stream(input);
std::cout << message.subject() << '\n';
}Next Steps
- Installation Guide: CMake setup and build details
- License: MIT license terms
- Developer Guide: MSG operations, MAPI properties, and CFB structure
- Features: Complete feature reference with C++ examples