Is it possible to attach the dynamically generated file at the run time to mail without storing somewhere else?


I am working in ax 7.

At the time of file generation instaed of storing the file somewhere, I need to attach the generated file to mail directlly at run time.

is it possible can anyone guide me how to achive this ?



It’s not possible having file without storing it, because file is actually a way to store data. If you keep data in memory, it’s not a file.

Maybe you wanted to ask whether you can attach data to an email without actually generating a file. The answer is “Yes, it’s possible”. SysMailerMessageBuilder class has addAttachment() method, which accepts a stream of data. If you actually have a file, use SysMailerMessageBuilder.addAttachmentFromFile() instead.