Skip to main content

Posts

Showing posts with the label e-mail

How to send emails from AX without requiring Outlook

Sending emails from AX has been somewhat of a pain when it tries to use Outlook. This post is a simple code modification to one method in \Classes\Info\reportSendMail. I did not develop this code, I merely tweaked it. The original poster's blog has disappeared, and I can only find non-working remnants all around the web of this, but it is just too useful not to repost. If you have Outlook 64bit edition, you might get the "Either there is no default mail client or the current mail client cannot fulfill the messaging request. Please run Microsoft Outlook and set it as the default mail client." Followed by an AX MAPI error. Or sometimes you may get the "A program is trying to access e-mail address information stored in Outlook."...Allow/Deny/Hlep. This change basically bypasses outlook. Put it in and give it a shot. void reportSendMail(PrintJobSettings p1) { //SysINetMail m = new SysINetMail(); System.Net.Mail.MailMessage mailM...

How to send emails from AX without requiring Outlook

Sending emails from AX has been somewhat of a pain when it tries to use Outlook.  This post is a simple code modification to one method in \Classes\Info\reportSendMail.  I did not develop this code, I merely tweaked it.  The original poster's blog has disappeared, and I can only find non-working remnants all around the web of this, but it is just too useful not to repost. If you have Outlook 64bit edition, you might get the "Either there is no default mail client or the current mail client cannot fulfill the messaging request.  Please run Microsoft Outlook and set it as the default mail client."  Followed by an AX MAPI error. Or sometimes you may get the "A program is trying to access e-mail address information stored in Outlook."...Allow/Deny/Hlep. This change basically bypasses outlook.  Put it in and give it a shot. void reportSendMail(PrintJobSettings p1) { //SysINetMail m = new SysINetMail(); System.Net.Mail.MailMessage mailMess...

Email techniques in AX 4.0

In this article, I am going to demonstrate different email techniques that can be used in AX 4.0. Following classes can be used to send an email Mapi and its related classes SysMailer SysInetMail SysEmailBatch SmmOutlookEmail MAPI technique: Following code demonstrates the usage of mapi class for sending email. It uses outlook to send mail. static void emailThruMapi(Args _args) { MapiEx mapiEx; MapiExMail mapiExMail; boolean mapiInitialised; COM outlook; COM item; COM outlookNameSpace; COM folder; COM attachments; str storeId; str entryId; #define.outlookapplication(‘Outlook.Application’) #define.mapi(‘Mapi’) #smmMSOutlook2002ObjectModelConstants #define.htmlText(‘ Hi There ’) ; outlook = new COM (#outlookapplication); outlookNameSpace = outlook.getNameSpace(#mapi); outlookNameSpace.logon(); folder = outlookNameSpace.getDefaultFolder(#olFolderInbox); item = outl...

send e-mail

I have created a new class with a static method that I can easily call from any .update() method to alert me when a record changes, and what changed in the record. static void CompareAndEmail(str emailTemplateName, str nameField, str recipient, Common original, Common modified) {     UserInfo    userInfo;     Map         emailParameterMap = new Map(Types::String, Types::String);     str         changes;     int         i, fieldId;        DictTable   dictTable = new DictTable(original.TableId);     DictField   dictField; ;     for (i=1; i<=dictTable.fieldCnt(); i++)     {         fieldId = dictTable.fieldCnt2Id(i);         dictFie...