web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Sending email from D365fo

(0) ShareShare
ReportReport
Posted on by 570

Hi All

Newfilename = @”c://Test//data.csv”

I use below code for sending email from D365fo.

Am received  the email but with out data ,only file name only am receiving please check the below image

 

   var messageBuilder = new SysMailerMessageBuilder();

        messageBuilder.setFrom("");

        messageBuilder.addTo("")

                   .setSubject("Test")

            .setBody("Test");           

            

        messageBuilder.addAttachment(stream,newfilename);

      

        SysMailerFactory::getNonInteractiveMailer().sendNonInteractive(message);

NO-data.PNG0601.error.PNG

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    What is the purpose of the file name? Are you attempting to attach file from your computer? That will not work, since D365 is a cloud service that has no way of accessing people's workstations and reading files from them. If you think about it, it would be the end of security in Internet, if any program in the public Internet could read files from your computer.

    The only way how D365 can get files from your computer is that if the file is uploaded by user or program that has access to your computer.

  • TonyAx Profile Picture
    570 on at

    Thanks for reply Nikolaos my problem is, I can send the email with attachment.

    But while receiving am not get any data from the attachment. Only empty file am receiving .

  • nmaenpaa Profile Picture
    101,162 Moderator on at

    Did you read my previous message where I explained why you can't handle local files with D365?

    Also, could you please answer the questions that I asked in my previous message. That way you will get much better help.

  • TonyAx Profile Picture
    570 on at

    Client need some data from customize table in email attachment.

    And email will send every week end atomically .

  • Verified answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    So, just create the attachment in code, populate it from the table, and attach it to the email. As mentioned above, you can't access your local file system (C:\temp) from D365FO.

    Or, create data entity for your table, and use Flow or Logic Apps to read this data entity weekly and send the result as email.

  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hello Tony,

    Another and possibly easier way is creating an electronic report in the organization admin module.

    That is because you can save the record by default on SharePoint and then use Flow/PowerAutomate to distribute it to various people.

    Also, electronic reports can be schedules as any other report and thereby be created in regular intervals as required.

    That works all out of the box and does not need a customization.

    Best regards,

    Ludwig

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 503 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 434 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans