Aspose.Email FOSS for C++ एक MIT-licensed, open-source C++ लाइब्रेरी है जो Microsoft Outlook .msg फ़ाइलों और Compound File Binary (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 कंटेनरों और एम्बेडेड सिस्टम्स के लिए उपयुक्त बनती है।
एक एंटरप्राइज़ संस्करण जिसमें अतिरिक्त सुविधाएँ हैं, Aspose.Email for C++ के रूप में पेश किया जाता है।
cfb_reader::from_file(), cfb_reader::from_stream(), या cfb_reader::from_bytes() के माध्यम से।storage_ids(), stream_ids(), और child_ids() का उपयोग करके स्टोरेज और स्ट्रीम को सूचीबद्ध करें, और resolve_path() के साथ नेस्टेड पदानुक्रमों को नेविगेट करें।cfb_node::is_storage() और cfb_node::is_stream() से करें, टाइमस्टैम्प creation_time() और modified_time() के माध्यम से पढ़ें।cfb_document के साथ CFB दस्तावेज़ बनाएं और cfb_writer::to_bytes() या cfb_writer::write_file() के माध्यम से बाइट्स या फ़ाइल में सीरियलाइज़ करें।.msg फ़ाइलों के लिए कंटेनर फ़ॉर्मेट है — सीधे CFB एक्सेस से फॉरेंसिक निरीक्षण और मरम्मत संभव होती है।msg_reader::from_file() या msg_reader::from_stream() के साथ खोलें और अंतर्निहित MAPI प्रॉपर्टी स्ट्रीम्स और अटैचमेंट सब-स्टोरेजेज़ तक पहुंचें।msg_document से MSG फ़ाइलें उत्पन्न करें msg_writer::to_bytes() या msg_writer::write_file() के साथ।msg_document::major_version(), msg_document::minor_version() के माध्यम से, और msg_document::strict() के साथ कड़ाई की जाँच करें।msg_document::to_cfb_document() के माध्यम से निकालें।.msg फ़ाइलों को बल्क-रीड करें और मेटाडेटा या अटैचमेंट निकालें।mapi_message::create() के साथ, फिर विषय, बॉडी, और HTML बॉडी को set_subject(), set_body(), और set_html_body() के माध्यम से सेट करें।set_sender_name(), set_sender_email_address(), और set_sender_address_type() को कॉन्फ़िगर करें।mapi_attachment::from_bytes() और mapi_attachment::from_stream() के साथ संलग्नक लोड करें, और is_embedded_message() के माध्यम से एम्बेडेड संदेशों की जाँच करें।mapi_message::save() के साथ सीरियलाइज़ करें और mapi_message::from_file() या mapi_message::from_stream() के साथ पुनः लोड करें।.eml फ़ाइल (RFC 5322 / MIME) को mapi_message::load_from_eml() के माध्यम से पूर्ण mapi_message ऑब्जेक्ट में पार्स करें।mapi_message को save_to_eml() के साथ MIME फ़ॉर्मेट में पुनः सीरियलाइज़ करें।.eml और .msg फ़ाइलों का एकल फ़ॉर्मेट में सामान्यीकृत करें।स्ट्रीम से एक Outlook MSG फ़ाइल खोलें और विषय प्रिंट करें — Microsoft Outlook की आवश्यकता नहीं।
#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';
}
प्रेषक, प्राप्तकर्ता और संलग्नक के साथ एक पूर्ण ईमेल बनाएं, फिर इसे MSG और EML दोनों फ़ॉर्मैट में लिखें।
#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);
}