Hi,
I have a Dynamics Nav 2015 installed on a domain server. When I try sending a quote (or any other attachment for that matter) via email, it gives me an error on the AddAttachment function.
Microsoft Dynamics NAV
---------------------------
Attachment C:\ProgramData\Microsoft\Microsoft Dynamics NAV\80\Server\MicrosoftDynamicsNavServer$DynamicsNAV80M\users\default\TALIDA\EDMHILAL\TEMP\__TEMP__d14eb1d1b6254de3993bd2792f8a9495.tmp.pdf does not exist or can not be accessed from the program.
---------------------------
OK
---------------------------
The error is showing on this path location and on any another path on the server. although I have gave already a full permission on all the folders.
SMTP is setup correctly and used the test mail feature which was successful.
what do you think about this error?
*This post is locked for comments
you need to download the pdf on client machine.
The idea is that my code is working correctly on my local database NAV2016 but on the client server NAV2015 has showing the error.
Hello Binesh,
This is my code Dear,
ServerAttachmentFilePath := '';
ServerAttachmentFilePath := FileManagement.ServerTempFileName('pdf');
SalesStatisticReport.SAVEASPDF(ServerAttachmentFilePath);
CLEAR(SalesStatisticReport);
IF NOT EXISTS(ServerAttachmentFilePath) THEN
ERROR(ServerSaveAsPdfFailedErr);
SMTPMail.AddAttachment(ServerAttachmentFilePath, 'Salesstatistic.PDF');
SMTPMail.Send;
The saving function is working correctly and my error is on Addattachment function.
The location is correct dear.
The file name has generated automatically from NAV and you can open it.
You should check standard code for addattachment, there is change in the function, now it requires two parameter.
Hello Ahmad,
Before attachment write some more line, see bellow code
// Here FileNameWithPath and ToFille is a text variable, And FileMgt is a codeunit 419.
//Now in ToFile upload your file as you doing, or see bellow.
ToFile := FileMgt.UploadFileSilent('C:\TEMP\RUWMSP.pdf');
//Now you have to download file from temp path
FileNameWithPath := FileMgt.DownloadTempFile(ToFile);
// Finally pass the Variable FileNameWithPath in your AddAttachment function. :)
Ahmad Barbar ,
i don't think this is the location that your file exactly stored right ?
have you test mail with attachment ?
I think your file name has problem as it contains .tmp.pdf . This might me problem
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,113 Super User 2024 Season 2
Martin Dráb 229,918 Most Valuable Professional
nmaenpaa 101,156