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 NAV (Archived)

How to send a automatic email in nav 2016

(0) ShareShare
ReportReport
Posted on by

Hi friends,

I want to send a email automatically in NAV 2016,

This is my code

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);

SMTP.CreateMessage('Jonas Wood','ashwini.e@sharpsyssoft.com','','Outstanding Amount','',TRUE) ;

SMTP.AddCC('ashwini.e@sharpsyssoft.com');

SMTP.AppendBody('Dear Sir / Madam,');

SMTP.AppendBody('<br><br>');

SMTP.AppendBody('Please find the Customer Outstading Amount in PDF Format:');

SMTP.AppendBody('<br><br>');

SMTP.AppendBody('Regards');

SMTP.AppendBody('<br>');

SMTP.AppendBody('Company Accounts Departments ');

SMTP.AddAttachment(Path,PdfDocPath);

SMTP.Send;

//ERASE(Path);

i can send a mail but not automatic but i want send a mail automatically in NAV 2016 please give any suggestion.

Thank you

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    keoma Profile Picture
    32,729 on at

    to run a job (also your code) automatic you can use the job queue, for that follow community.dynamics.com/.../set-up-job-queues-in-dynamics-nav

  • Community Member Profile Picture
    on at

    Hi Jonathan

    Thank you very much for your reply i have created the job queue for my report i need to send this report all users Mail. please tell me where i need to add my email id

    scrn.png

    Thank You

  • Suggested answer
    Amol Salvi Profile Picture
    18,698 on at

    I would suggest  add required email id in the program itself and then schedule to send it using job queue.

  • Community Member Profile Picture
    on at

    Hi Amol
    thank you for you reply i have added the email in my report cal code even though i did nt get any email.

    fser.png
    Thank you

  • Sarav Profile Picture
    443 on at

    Hi Ashwini,

    I'm not sure about your requirement. Please go through the following link which was helpful to me on generating the Customer Statement.

    saurav-nav.blogspot.sg/.../microsoft-dynamics-nav-2017-email-from.html

    Thanks & Regards,

    Saravanan

  • Community Member Profile Picture
    on at

    Hi Saravanan,

    thank you for your reply i need to send a mail automatically using job queue.please help on this one.

    Thank you

  • Sarav Profile Picture
    443 on at

    Based on your screenshots I believe it is about generating customer outstanding as a report on a specific date of month (correct me if I'm wrong).

    As mentioned earlier by Mr Jonathan, Job queue is the right way to automate it.

    I can provide few areas where we need to check for this scenario.

    1. After setting up the Job Queue, check the Job Queue Log Entries from Job Queue Entries. Check whether the status is SUCCESS or Failure.

    2. Since it is a report from the Customer, ensure there is a Outstanding Amount for that Customer on that period which you are trying the report.

    3. Instead of SMTP Mail Codeunit (400), you can try createmessage function from Mail codeunit (397) as it is available in NAV 2016.

    Thanks & Regards,

    Saravanan

  • Suggested answer
    Suresh Kulla Profile Picture
    50,269 Super User 2026 Season 1 on at

    Ashwini,

    Please check your SMTP setup and Test Email Setup to make sure your SMTP Server is working before adding the code.

  • Community Member Profile Picture
    on at

    Hi suresh

    Thank you for your reply i want to send  a report for particular user mail id i have added mail id in report CAL code page.

    please see the below screen shot i want to know where i need to add the email id,

    7838.fser.png

    Thank you

  • Suggested answer
    Suresh Kulla Profile Picture
    50,269 Super User 2026 Season 1 on at

    Ashwini,

    Before adding the code, Open SMTP Mail Setup and check your server settings and click the action Test Email Setup to make sure it is working.

    The above seems fine to me, check your event viewer for any errors.

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans