Send mail via populate the outlook client by code in axapta

To Send mail via populate the outlook client by code in axapta

#ObjOutlookCOMDEF
#define.outlook("Outlook.Application")
#define.mapi("MAPI")
COM ObjOutlook;
COM ObjOutlookNameSpace;
COM ObjOutlookMailItem;
COM ObjOutlookAttachment;
COM ObjOutlookRecipient;
;

ObjOutlook = new COM(#outlook);
ObjOutlookNameSpace = ObjOutlook.getNamespace(#mapi);
ObjOutlookNameSpace.logon();
ObjOutlookMailItem = ObjOutlook.CreateItem('Outlook.OlItemType.olMailItem');
ObjOutlookMailItem.To("sksinght@abc.com");
ObjOutlookMailItem.Subject("Testing");
ObjOutlookAttachment = ObjOutlookMailItem.Attachments();
ObjOutlookAttachment.Add(@"d:\xyz.pdf",1,1,"New");
ObjOutlookMailItem.save();
ObjOutlookMailItem.display();

info("Activity launched in Microsoft Outlook");
ObjOutlookNameSpace.logoff();

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.