When working with batch processes or customer reports in Dynamics 365 Finance and Operations, there are situations where you want to generate Excel files in-memory and send them via email—all without saving anything locally.
Let’s dive into how you can achieve this using X++ and SMTP (Office365).
✅ Final Output
-
Excel file created dynamically
-
Memory stream used to avoid physical storage
-
Email sent with Excel as attachment via SMTP
🧾 X++ Code – Generate Excel & Send via Email
✅ Notes
-
Make sure to reference EPPlus DLL in your AOT project.
-
Replace
MyLogTableBuffer
,MyLogStatus
, and other placeholder names with your actual table/enums. -
You can configure SMTP in System administration > Email parameters.
0 Comments