Extract MBOX Metadata via C++
Build your own C++ apps to add, edit, remove or extract metadata from MBOX files using server-side APIs.
How to Get MBOX Metadata Using C++
In order to extract MBOX metadata, we’ll use
API which is a feature-rich, powerful and easy to use document metadata extraction API for C++ platform. You can download its latest version directly, just open
package manager, search for Aspose.Email.Cpp and install. You may also use the following command from the Package Manager Console.
Command
PM> Install-Package Aspose.Email.Cpp
Steps to Extract Metadata of MBOX via C++
Get the type of the message while using GetProperties which in turn allows getting all metadata information via a simple loop.
- Load the MBOX file via MapiMessage::FromFile
- Get properties collection using get_Properties()
- Get the respective property using idx_get
System Requirements
Aspose.Email for C++ supports on all major platforms and Operating Systems. Please make sure that you have the following prerequisites.
- Microsoft Windows or a compatible OS with C++ Runtime Environment for Windows 32 bit, Windows 64 bit and Linux 64 bit.
- Aspose.Email for C++ DLL referenced in your project.
Extract Metadata of MBOX - C++
// Load from file
System::SharedPtr<MapiMessage> mbox = MapiMessage::FromFile(dataDir + L"message.mbox");
System::String subject;
// Access the MapiPropertyTag.PR_SUBJECT property
System::SharedPtr<MapiProperty> prop = mbox->get_Properties()->idx_get(MapiPropertyTag::PR_SUBJECT);
// If the property is not found, check the MapiPropertyTag.PR_SUBJECT_W (which is a // Unicode peer of the MapiPropertyTag.PR_SUBJECT)
if (prop == nullptr){
prop = mbox->get_Properties()->idx_get(MapiPropertyTag::PR_SUBJECT_W);
}
// Cannot found
if (prop == nullptr){
System::Console::WriteLine(L"No property found!");
return;
}
// Get the property data as string
subject = prop->GetString();
System::Console::WriteLine(System::String(L"Subject:") + subject);
// Read internet code page property
prop = msg->get_Properties()->idx_get(MapiPropertyTag::PR_INTERNET_CPID);
if (prop != nullptr){
System::Console::WriteLine(System::String(L"CodePage:") + prop->GetLong());
}
About Aspose.Email for C++ API
Aspose.Email is a Microsoft Outlook and Thunderbird formats parsing solution. One can easily create, manipulate, convert email and storage formats such as MSG, EMLX, EML and MHT. Handling of email attachments, customization of message headers and implementation of different network protocols like POP3, IMAP & SMTP to send & receive emails is much easier. Its a standalone API and does not require Microsoft Outlook or any other software installation.Extract Metadata of MBOX via Online App
View & edit Metadata to MBOX documents by using our Live Demos with following benefits.
MBOX What is MBOX File Format
MBox file format is a generic term that represents a container for collection of electronic mail messages. The messages are stored inside the container along with their attachments. Messages from an entire folder are saved in a single database file and new messages are appended to the end of the file. Numerous applications and API provide support for MBox file format such as Apple Mail and Mozilla Thunderbird.
Read More