Browse our Products
Aspose.Email for CPP 22.12 Release Notes
Aspose.Email for C++ 22.12 is based on Aspose.Email for .NET 22.11.
Aspose.Email for C++ does not support asyncronic features of e-mail protocols
New Features
Getting a MAPI item type
We have added the MapiItemType
enum that represented an item type. It can be used for message conversion into an object of a corresponding class derived from the IMapiMessageItem
interface.
This avoids users from checking the MessageClass
property value before message conversion.
Usage:
foreach (var messageInfo in folder.EnumerateMessages())
{
auto msg = pst->ExtractMessage(messageInfo);
switch (msg->get_SupportedType())
{
// Non-supported type. MapiMessage cannot be converted to an appropriate item type.
// Just use in MSG format.
case MapiItemType::None:
break;
// An email message. Conversion isn't required.
case MapiItemType::Message:
break;
// A contact item. Can be converted to MapiContact.
case MapiItemType::Contact:
break;
// A calendar item. Can be converted to MapiCalendar.
case MapiItemType::Calendar:
break;
// A distribution list. Can be converted to MapiDistributionList.
case MapiItemType::DistList:
break;
// A Journal entry. Can be converted to MapiJournal.
case MapiItemType::Journal:
break;
// A StickyNote. Can be converted to MapiNote.
case MapiItemType::Note:
break;
// A Task item. Can be converted to MapiTask.
case MapiItemType::Task:
break;
}
}
Removing a Signature from a MapiMessage
For better compatibility, the MapiMessage::RemoveSignature
method and MapiMessage::get_IsSigned
property were added.
Code example:
auto msg = MapiMessage::Load(fileName);
if (msg->get_IsSigned())
{
auto unsignedMsg = msg->RemoveSignature();
}
Checking whether the folder is in a predefined folder
Added FolderInfo::GetPredefinedType(bool getForTopLevelParent)
method, to check folder is from StandardIpmFolder
.
If getForTopLevelParent
param is true
, method returns a StandardIpmFolder
enum value for the top-level parent folder. This determines whether the current folder is a subfolder of a predefined folder.
If getForTopLevelParent
param is false, it returns a StandardIpmFolder
enum value for the current folder.
void CheckFolders(FolderInfoCollection folders)
{
for (auto&& folder: System::IterateOver(folders))
{
Console::WriteLine(u"Display Name: ");
Console::WriteLine(folder->get_DisplayName());
// Determines whether the current folder is a predefined folder
auto folderType = folder->GetPredefinedType(false);
if (folderType == StandardIpmFolder::Unspecified)
{
Console::WriteLine(u"Is StandardIpmFolder?: No");
}
// Determines whether the current folder is a subfolder of a predefined folder
if (folderType == StandardIpmFolder::Unspecified)
{
folderType = folder->GetPredefinedType(true);
answer = folderType == StandardIpmFolder::Unspecified ? u"No" : u"Yes";
Console::WriteLine(u"Is subfolder from StandardIpmFolder parent?: ");
Console::WriteLine(answer);
}
Console::WriteLine();
CheckFolders(folder->GetSubFolders());
}
}
String fileName = u"my.pst";
auto pst = PersonalStorage::FromFile(fileName))
CheckFolders(pst->get_RootFolder()->get_GetSubFolders());
Checking whether attachment is a TNEF formatted message
The Attachment::get_IsTnef()
property indicates whether the message attachment is TNEF formatted message.
Usage:
auto eml = MailMessage->Load(fileName);
for (auto&& attachment : System::IterateOver(eml->get_Attachments()))
{
if (attachment->get_IsTnef())
Console::WriteLine("Attachment is TNEF");
}
The full code of the examples can be found at Aspose Email for C++ GitHub examples repository.