Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

How to send a automatic email in nav 2016

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to send a automatic email in nav 2016

    You can used the Job queue for automatically.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to send a automatic email in nav 2016

    Hi suresh

    my smtp mail test mail is working properly  even though i can not receive automatic mail  using job queue i have added the code unit user mail

    this is my code screen shot

    smpt2.png

    this is my job queue screen shot

    smpt2.png

    i didnt receive  any email from job queue (auto mail) but receive smtp test mail please help me on this one 

    Thank you

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: How to send a automatic email in nav 2016

    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.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to send a automatic email in nav 2016

    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
    Suresh Kulla 43,745 on at
    RE: How to send a automatic email in nav 2016

    Ashwini,

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

  • Sarav Profile Picture
    Sarav 423 on at
    RE: How to send a automatic email in nav 2016

    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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to send a automatic email in nav 2016

    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
    Sarav 423 on at
    RE: How to send a automatic email in nav 2016

    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
    Community Member Microsoft Employee on at
    RE: How to send a automatic email in nav 2016

    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

  • Suggested answer
    Amol Salvi Profile Picture
    Amol Salvi 18,694 on at
    RE: How to send a automatic email in nav 2016

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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,462 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,551 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans