Skip to main content

Posts

Showing posts with the label send

Send message to online user in Dynamics AX

static void sendAlert(Args _args) { EventInbox inbox; EventInboxId inboxId; inboxId = EventInbox::nextEventId(); inbox.initValue(); inbox.ShowPopup = NoYes::Yes; inbox.Subject = "Message to online user"; inbox.Message = "Message you want to send to user"; inbox.SendEmail = false; inbox.UserId = curUserID(); inbox.InboxId = inboxId; inbox.AlertCreatedDate = systemdateget(); inbox.AlertCreateTime = timeNow(); inbox.insert(); }

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...

Send message to online user in Dynamics AX

static void sendAlert(Args _args) { EventInbox inbox; EventInboxId inboxId; inboxId = EventInbox::nextEventId(); inbox.initValue(); inbox.ShowPopup = NoYes::Yes; inbox.Subject = "Message to online user"; inbox.Message = "Message you want to send to user"; inbox.SendEmail = false; inbox.UserId = curUserID(); inbox.InboxId = inboxId; inbox.AlertCreatedDate = systemdateget(); inbox.AlertCreateTime = timeNow(); inbox.insert(); }

How to send email messages with attachments

Sending E-mail messages from Microsoft Dynamics AX could be a bit tricky. As I mentioned in a following blog post, the most recommended way to do so is by using the standard mail mechanism built in the system. The Email sending status form (based on table SysOutgoingEmailTable ) and the E-mail distributor batch job (read more about it here ). But if you want to send email with attachments and more advance options, you should do so with .NET Framework, and the System.Net.Mail object. First of all, make sure you have a correctly configured SMTP server. Go to Administration -> Setup -> E-mail parameters and fill the required settings: (Form: SysEmailParameters) Then, use this code sample: void SendMail() { System.Net.Mail.MailMessage mailMessage; System.Net.Mail.Attachment attachment; System.Net.Mail.AttachmentCollection attachementCollection; System.Net.Mail.SmtpClient smtpClient; System.Net.Mail.MailAddress ...

How to send email messages with Microsoft Dynamics AX

There are more than one way to send emails through Microsoft Dynamics AX system, using X++ code. The most recommended way is to use the standard mail mechanism built in the system. That way copies of any email you send will be save in the Email sending status form (based on table SysOutgoingEmailTable ) and you will be able to monitor and see status of sent emails: (Administration -> Periodic -> E-mail processing -> Email sending status; Form: SysOutgoingEmailTable) This mechanism based on a system table that contain the emails, and a batch job that scan that table and send the emails, one by one (with retries and status controlling). This technique is very simple to use and therefore it has some disadvantages; you cannot add attachments or use advanced email properties (cc, bcc, priority flag, etc). To use this mechanism, first you have to make sure you a SMTP server configured and running. Go to Administration -> Setup -> E-mail parameters and fill the required se...

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...