Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The Mapi class enables email to be sent, received, and managed in most major mail systems, such as Microsoft Exchange systems, Microsoft Outlook Express, and Lotus CCMail.
public ref class Mapi : Microsoft::Dynamics::Ax::Xpp::XppObjectBase
[Microsoft.Dynamics.Ax.Xpp.KernelClass]
public class Mapi : Microsoft.Dynamics.Ax.Xpp.XppObjectBase
[<Microsoft.Dynamics.Ax.Xpp.KernelClass>]
type Mapi = class
inherit XppObjectBase
Together with the other Mapi classes, MapiMessage, MapiRecipDesc, and MapiFileDesc, this class lets you specify multiple recipients, file attachments, message text, and a subject. The easiest approach is to set up a working mail client on the machine, and make sure that this works correctly order by sending and receiving a few email messages. Flags for the Mapi methods are located in the Mapi macro. You include this macro in code where you use the Mapi classes together with the #MAPI statement.
The following example shows how to send an email message by using this class.
static void example()
{
#Mapi
Mapi m = new Mapi();
MapiMessage msg = new MapiMessage();
MapiRecipDesc recip = new MapiRecipDesc();
// Set up the recipient.
recip.Name("someone");
recip.RecipClass(#MAPI_TO);
msg.setRecipNo(1,recip);
// Log on using default profile.
m.Logon("","",#MAPI_USE_DEFAULT);
// Send the mail, and allow the user to modify the
// Subject, Text and Recipients in the Send Mail Dialog.
m.SendMail(msg,#MAPI_DIALOG);
// Log off.
m.Logoff();
}