Sending a mail from Orders form

I need to send a mail directly from Orders form. Instead of “Print” the customer needs a button Send. I can fill the “To” field on MAPI client from Orders header, but I can not fill the contents of the report to the body of the mail. How can I access the “Send…” command appearing only in the application’s Main Menu from C/AL code?

You should be able to do this using the functionality already built by Navision in the Mail codeunit (397). If you want something other than the basic functionality provided by this codeunit (i.e. Larger Body), you can just use this as a template and create your own function.

Dear Jozef, To my knowledge you can’t do this directly, if you are think of a function that works similar to SAVEASHTML. But what you do was to create a function that uses SAVEASHTML to save a ORDER file and the use codeunit 397 as Chris suggested to send that file using MAPI. You can set the function to either send unattended or attended, meaning that you have to bring up your MAPI mail client and select send. ============ Best regards, Erik P. Ernst, webmaster Navision Online User Group

Thanks, that’s it. Stupid, but never heard about CU397. JK