Friday, January 6, 2012

Send mail through AX withought SMTP configuration

static void example()
{
#Mapi
Mapi m = new Mapi();
MapiMessage msg = new MapiMessage();
MapiRecipDesc recip1 = new MapiRecipDesc();
MapiRecipDesc recip2 = new MapiRecipDesc();


// Set up the recipient.
recip1.Name("MailTo");
recip1.RecipClass(#MAPI_TO);
msg.setRecipNo(1,recip1);
recip2.Name("MailCC");
recip2.RecipClass(#MAPI_CC);
msg.setRecipNo(1,recip1);
msg.setRecipNo(1,recip2);
// Log on using default profile.
m.Logon("columbushr@ae.columbusit.com","pass@word1",#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);

// Log off.
m.Logoff();
}