Notifications
Announcements
No record found.
Hi Friends,
How to send a mail in nav with report attachment with report filters in nav 2016.
Thank You
*This post is locked for comments
Hi,Please have a look at the following links and then let me know if you would still have any question. ThanksHow to apply filters to a report:https://dynamicsuser.net/nav/f/developers/10566/passing-filter-to-a-reporthttps://community.dynamics.com/nav/f/34/t/147548
https://nav-magno.be/2015/06/printing-pdf-reports-in-classic-without-external-components/How to send attachment using SMTP:https://community.dynamics.com/nav/b/arounddynamicsnavworld/archive/2017/02/08/how-to-print-reports-to-pdf-and-send-emailhttps://community.dynamics.com/nav/b/technicaltipsandtricksfordynamicsnav/archive/2015/07/31/creating-file-attachment-to-mail-for-report
Hi Zaid
thank you reply
i have used this code in separate code unit and called in page action
Customer.RESET;
//Customer.SETRANGE(PDF Generated', FALSE);
IF Customer.FINDSET THEN BEGIN
REPEAT
Filename:= Customer."No.";
REPORT.SAVEASPDF(59996, Filename, Customer); //PDF CREATED BY SAVEAS FUNCTION
UNTIL Customer.NEXT = 0;
END;
Subject := 'SUBJECT SAMPLE TEXT' ;
Body := 'BODY SAMPLETEXT';
SMTP.CreateMessage(SMTPmailsetup."Email Sendor Name",SMTPmailsetup."Email Sendor Emil",
Customer."E-Mail",'Customer Email','',TRUE);
Body := Body + 'OTHER';
SMTP.AppendBody(Body);
SMTP.Send;
MESSAGE('Mail Sended');
its loading only i did nt get any solution.
I need to attach the report in SMTP mail please give any suggesstion.
Hello Dear,
I have customised my below code, I am using this for send the pdf with attachments. Hope it will help you.
PdfDocPath :='ABC.pdf';
Path := 'C:\Temp\'+PdfDocPath; // Directory + Path
CLEAR(ABC); // ABC is a Report 50088
ABC.USEREQUESTPAGE(FALSE); //// for filteration
IF NOT ABC.SAVEASPDF(Path) THEN
ERROR('PDF Creating Failed!\\ERROR:\\' + GETLASTERRORTEXT);
SMTpMail.CreateMessage('Company Limited','NAV@ITC.com','','Subject Line','',TRUE);
SMTpMail.AppendBody('Dear Sir / Madam,');
SMTpMail.AppendBody('<br><br>');
SMTpMail.AppendBody('Please find the Ledger Details in PDF Format:');
SMTpMail.AppendBody('Regards');
SMTpMail.AppendBody('<br>');
SMTpMail.AppendBody('Company Accounts Departments ');
SMTpMail.AddAttachment(Path,PdfDocPath);
SMTpMail.Send;
ERASE(Path);
Hi,The function SMTPMail.AddAttachment is the method you can use to attach the file. If you are facing any error please specify. Thanks
To add the attachement to the email you need to use the AddAttachment Function. For example check the below code for the
Where Invoice is the Report
Invoice.USEREQUESTPAGE(FALSE);
IF Invoice.SAVEASPDF(FileName) THEN BEGIN
SMTPMail.CreateMessage(
CompanyInformation.Name,
CompanyInformation."E-Mail",
Cust."E-Mail",
STRSUBSTNO('%1 %2.pdf',TABLECAPTION,"No."),
Text003,
TRUE);
SMTPMail.AddAttachment(FileName);
SMTPMail.Send;
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.