Aspose.Email FOSS for C++는 MIT 라이선스를 가진 오픈 소스 C++ 라이브러리로, Microsoft Outlook .msg 파일 및 복합 파일 바이너리(CFB) 컨테이너 작업을 지원합니다. CMake를 통해 헤더를 포함하고 Microsoft Outlook이나 독점 런타임을 설치하지 않고도 즉시 이메일 메시지를 읽고, 생성하고, 처리할 수 있습니다.
이 라이브러리는 두 가지 수준의 접근 방식을 제공합니다. 낮은 수준에서는 cfb_reader와 cfb_writer가 CFB 바이너리 컨테이너에 대한 완전한 제어를 제공하며, 디렉터리 항목을 탐색하고, 스토리지 노드와 스트림 데이터를 읽고 쓰며, 원시 섹터 레이아웃을 검사할 수 있습니다. msg_reader와 msg_writer는 CFB 위에 있는 MSG 형식을 처리하여 MAPI 속성 스트림, 수신자 테이블 및 첨부 파일 서브 스토리지를 노출합니다. 높은 수준에서는 mapi_message를 사용하여 처음부터 새 메시지를 만들고, 제목, 본문, 수신자 및 첨부 파일을 읽으며, MSG와 EML 형식 간에 변환할 수 있습니다.
이 라이브러리는 C++17 컴파일러가 있는 모든 플랫폼에서 빌드되며 외부 종속성이 없어 Windows, Linux, macOS, Docker 컨테이너 및 임베디드 시스템에 적합합니다.
cfb_reader::from_file(), cfb_reader::from_stream(), or cfb_reader::from_bytes().storage_ids(), stream_ids(), and child_ids(), and navigate nested hierarchies with resolve_path().cfb_node::is_storage() and cfb_node::is_stream(), read timestamps via creation_time() and modified_time().cfb_document and serialize to bytes or file via cfb_writer::to_bytes() or cfb_writer::write_file()..msg files — direct CFB access enables forensic inspection and repair.msg_reader::from_file() or msg_reader::from_stream() and access the underlying MAPI property streams and attachment sub-storages.msg_document with msg_writer::to_bytes() or msg_writer::write_file().msg_document::major_version(), msg_document::minor_version(), and check strictness with msg_document::strict().msg_document::to_cfb_document()..msg files from archive directories and extract metadata or attachments.mapi_message::create(), then set subject, body, and HTML body via set_subject(), set_body(), and set_html_body().set_sender_name(), set_sender_email_address(), and set_sender_address_type() for the outgoing message.mapi_attachment::from_bytes() and mapi_attachment::from_stream(), and check for embedded messages via is_embedded_message().mapi_message::save() and reload with mapi_message::from_file() or mapi_message::from_stream()..eml file (RFC 5322 / MIME) into a full mapi_message object via mapi_message::load_from_eml().mapi_message back to MIME format with save_to_eml()..eml and .msg files to a single format.Open an Outlook MSG file from a stream and print the subject — no Microsoft Outlook required.
#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';
}
Build a complete email with sender, recipient, and attachment, then write it to both MSG and EML formats.
#include <fstream>
#include "aspose/email/foss/msg/mapi_message.hpp"
int main()
{
auto message = aspose::email::foss::msg::mapi_message::create("Hello", "Body");
message.set_sender_name("Alice");
message.set_sender_email_address("alice@example.com");
message.add_recipient("bob@example.com", "Bob");
message.add_attachment("note.txt", std::vector<std::uint8_t>{'a', 'b', 'c'}, "text/plain");
std::ofstream msg_output("hello.msg", std::ios::binary);
message.save(msg_output);
std::ofstream eml_output("hello.eml", std::ios::binary);
message.save_to_eml(eml_output);
}