Hello
In order to display recipient email address in outlook (classic) in PST file it is needed to setup “SMTP” address type.
For email which was already sent, outlook will not show the recipient email (outlook displays it is like a contact) for recipient without AddressType
var recipients = new new MapiRecipientCollection();
recipients.Add("test@mail.com", "test", MapiRecipientType.MAPI_TO);
→ recipients[0].AddressType will be set as “UNKNOWN”.
This code will work fine:
var recipients = new new MapiRecipientCollection();
recipients.Add("test@mail.com", "SMTP", "test", MapiRecipientType.MAPI_TO);
Questions:
- Are there any public constants|enums in aspose email library that enumerate email address types?
- In terms of mail messages - address type should be always set to smtp? (For example what behaviour in library mail client)? Or only contacts can have different address types?
Thanks!
@Ilyaabramau
Summary
There is no publicly documented enum or constant in the Aspose.Email library that lists the possible MAPI address types. The library’s API does not expose a dedicated enumeration for values such as “SMTP”, “EX”, or “UNKNOWN” – you need to supply the address type as a string when adding a recipient.
Why it happens
Outlook expects the AddressType property of a MapiRecipient to be set to “SMTP” for standard email addresses. If the property is left empty or set to an unrecognised value (e.g., the default “UNKNOWN” that the SDK assigns when you use the overload without an explicit address type), Outlook treats the recipient as a contact and does not display the e‑mail address in the classic view of a PST file. Supplying “SMTP” explicitly forces Outlook to render the address correctly.
What to do next
- Use the overload that includes the address type – when creating a
MapiRecipient, always pass “SMTP” as the third argument for normal e‑mail recipients:
var recipients = new MapiRecipientCollection();
recipients.Add("test@mail.com", "SMTP", "test", MapiRecipientType.MAPI_TO);
- Check the official Aspose.Email documentation – the current docs do not list an address‑type enum, so refer to the API reference or contact Aspose support for any updates or custom constants they may have added in newer releases.
- For non‑SMTP address types (e.g., Exchange X500, custom contacts) you will need to supply the appropriate string value yourself; the library will store it verbatim.
- Verify with the target Outlook version – after saving the PST, open it in Outlook to ensure the recipient appears as expected.
If you need a definitive list of supported address‑type strings, the safest approach is to consult the latest Aspose.Email API reference or ask Aspose support directly, as the SDK does not expose a built‑in enumeration for this purpose.
I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.
SDK version unclear — refer to the official release notes before applying this guidance.