Browse our Products
Aspose.Email for CPP 23.12 Release Notes
Aspose.Email for C++ 23.12 is based on Aspose.Email for .NET 23.11.
Aspose.Email for C++ does not support asyncronic features of e-mail protocols
New Features
Validate Email Messages
This functionality allows users to validate message files, ensuring adherence to specified formats and structures. It supports validation for files/streams in the following formats:
- MIME Formats:
eml
,emlx
,mht
- MAPI Formats:
msg
,oft
API members:
Aspose::Email::Tools::Verifications::MessageValidator::Validate
Method - validate messages using this method, providing a file path or stream as input.
Aspose::Email::Tools::Verifications::MessageValidationResult
Class - encapsulates the results of the message validation process. Provides insights into the success of the validation, format type, and any encountered errors.
Aspose::Email::Tools::Verifications::MessageValidationErrorType
Enum - Enumerates different types of validation errors.
Code sample:
auto result = MessageValidator::Validate(fileName)
// Check if validation is successful
if (!result->get_IsSuccess())
{
Console::WriteLine(u"Validation failed.");
// Check the format type
if (result->get_FormatType() == FileFormatType::Mht)
{
Console::WriteLine(u"Format type is Mht.");
}
// Check and display errors
Console::WriteLine(String::Format("Number of errors: {0}", result.Errors.Count));
foreach (var error in result.Errors)
for (auto error : IterateOver(result->get_Errors()))
{
Console::WriteLine(String::Format(u"Error Type: {0}", error.ErrorType));
Console::WriteLine(String::Format(u"Description: {0}", error.Description));
}
}
else
{
Console::WriteLine(u"Validation successful.");
}
The full code of the examples can be found at Aspose Email for C++ GitHub examples repository.