Dear all, I need to find a way in Navision to automatically send a mail everytime a certain situation occcurs. I can’t use Codeunit 397 to send emails because it uses the windows mail client. We have about 70 clients logging in the DB and I can’t make all of them install Outlook or Eudora Pro or whatever other mail client that the codeunit might execute. As an alternative I downloaded and installed a very neat SMTP OCX from http://www.nowecor.de/users/stephan/Navision/smtpocx.htm It works, BUT, I have to install the OCX in EVERY Navision Client. It works on my computer, because I installed it. I tried to run it in another computer selecting the server as my computer and when I click the button in the Form designed to test this, it gives an error complaining it can’t find the OCX (duh!). Is there a way to send emails in Navision without having to install anything in every client? Thanks Bruno Fernandes NCSD, MCP http://www.ace-consulteam.com
Maybe you could do this: 1. Create a “eMail-Buffer-Table” where all users can store their eMail-Info (e.g. From-Address, To-Address, Topic, Body, …) 2. Create a eMail-Scheduler: a Form that reads the “eMail-Buffer-Table” periodically (OnTimer) and sends these eMails automatically (CU 397 or SMTP-OCX). 3. Dedicate one Client to process this eMail-Scheduler; only this client would need the OCX. Problems: - You need one Client(license) free - eMails are not sent in time, depends on scheduler-intervall - … Regards, Jörg Joerg A. Stryk Apollo-Optik, IT/ERP
That’s a good idea. I already have thought that possibility, but imagine that the user we select goes on vacantion (it’s summertime, now) for a week and the rest of the company continues to use the system. Using the approach you suggested, the mails wouldn’t be sent during that week. Just when the user would login, the OCX would pick the mails in the buffer table and process them… But thanks for the idea. Bruno Fernandes NCSD, MCP http://www.ace-consulteam.com Edited by - bfernandes on 2002 Jul 19 18:09:24
You could use a NAS to read the buffer table and send the email. Paul Baxter
You could try something like this. In the OnModify trigger on the table place a function. When the trigger is called the function will be called. You can check the values of Rec and XRec to see if they differ. In a system I’m working on at present we have added a field called Outlook Administrator to the resource card. When a resource is modified (only for certain fields) the system checks to see if there is an Outlook Admin setup and then fires them off an email to let them know that the details have been changed. A code example is below. Hope this helps. --------------------------------------------- IF Surname <> xRec.Surname THEN ChangeText := ChangeText + ‘Name,’; IF “Direct Dial Telephone” <> xRec.“Direct Dial Telephone” THEN ChangeText := ChangeText + ‘Direct Dial Telephone,’; // More IF STRLEN (ChangeText) >0 THEN BEGIN ChangeText := COPYSTR(ChangeText,1,(STRLEN(ChangeText)-1)); MailText[1] := ‘Changes have been made on the Resource Details held in Navision for "’ + Surname +’" '; MailText[2] := ‘to the following fields "’ + ChangeText + ‘".’ + Ret + ’ ’ + Ret; MailText[3] := ‘Please check / reflect these changes in Outlook.’ + Ret; MailText[4] := ’ ’ + Ret; MailText[5] := ‘Previous Details.’ + Ret; MailText[6] := 'Name : ’ + xRec.Surname + Ret; MailText[7] := ‘Direct Dial : ’ + xRec.“Direct Dial Telephone” + Ret; MailText[12] := Ret; MailText[13] := ‘New Details.’ + Ret; MailText[14] := ‘Name : ’ + Surname + Ret; MailText[15] := ‘Direct Dial : ’ + “Direct Dial Telephone” + Ret; Rec2.SETRANGE(Rec2.“Outlook Administrator”,TRUE); IF NOT Rec2.FIND(’-’) THEN IF NOT CONFIRM (‘There is no Outlook Administrator currently defined.’ + ‘As a result there will be no automated notification ’ + ‘of these changes. ’ + ‘Is this O.K.’) THEN ERROR(‘Record not changed’); //SendMail.NewMessage(ToName,CCName,Subject,BodyArray,AttachFileName,OpenDialog) IF NoMail = FALSE THEN BEGIN IF NOT SendMail.RUN THEN IF CONFIRM (‘There is a problem with sending the automated change notifications ’ + ‘Via E-Mail.’ + ‘As a result there will be no automated notification ’ + ‘of these changes. ’ + ‘Is this O.K.’) THEN BEGIN NoMail := TRUE; EXIT; END ELSE ERROR(’’); SendMail.NewMessage(Rec2.“Email Address”,’’, ‘Changes have been made on the Resource Details held in Navision’,MailText,’’,Rec2.“Email Address” = ‘’); END; END;
Or you could do as Mr Baxter suggests. I have just set up one of our systems to use NAS and it is integrated with Microsoft Message Queue… Let me know if you need any help.
Hi all, Thanks for all the replies. Actually, I’m going to make an email buffer table and make a user (just like a bot) that will read the table from time to time and so, just one client has the OCX installed. Actually this approach is the one that is faster to develop, just a few lines of codes, although I’d like to know more about Paul Baxter’s approach. If anyone could provide that information, please do! Thanks Bruno Fernandes NCSD, MCP http://www.ace-consulteam.com
Moved from “Attain/Financials Developer Forum” to “Attain/Financials Developer FAQ”.