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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

send mail with attached file PDF via x++

(0) ShareShare
ReportReport
Posted on by 20

Hello, 

i want to send mail with attached file PDF. I use this code, i recieve the email but without PDF File
please help to solve this issues!

public void SendMail()
{
   SysEmailTable sysEmailTable;
   Set MailSet;

   str attachFiles;
   Map mappings = new Map(Types::String, Types::String);
   str LangId = "fr-be";

   attachFiles = "D:\test\test.pdf";

  sysEmailTable = SysEmailTable::find('TenderTran');
  SysEmailTable::sendMail(sysEmailTable.EmailId,
                                         LangId,
                                        destination.text(), //value from stringEdit Control
                                        mappings,
                                        attachFiles,
                                         '' ,
                                       true,
                                      sysEmailTable.SenderAddr,
                                     true);

}

Thanks

*This post is locked for comments

I have the same question (0)
  • H_BR Profile Picture
    20 on at

    Hello Crispin,

    thanks for your response,

    i try to replace \ with \\

    attachFiles = "D:\test\test.pdf";

    but i have the same problème .

  • H_BR Profile Picture
    20 on at

    Hello Crispin,

    thanks for your response,

    i try to replace \ with \\

    attachFiles = "D:\test\test.pdf";

    but i have the same problème .

  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    A relative path like D:\something is not good because it means different things depending on where the code is executing (aos, another aos, client...). So it's good to use a UNC path like Crispin suggested. Also it's good to debug your code to make sure your path looks ok and \\s and such are behaving like you expect.

  • H_BR Profile Picture
    20 on at

    Hi Nikolaos,

    Thanks for replied, but i have the sames problème again :(

  • Verified answer
    Avinesh Chand Profile Picture
    120 on at

    SysEmailParameters table - fill in the AttachmentPath, should work

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans