Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

SMTP Mail

Posted on by Microsoft Employee

hi everyone,

Am having issues when sending mail. i pasted the below codes on page close 


MESSAGE("Email Address");
SMTP.CreateMessage('Interview Appointment',"Email Address",'seymalick@gmail.com','Interview Scheduled','',TRUE);
SMTP.AppendBody('Hello '+"Candidate No" +'' +Name);
SMTP.AppendBody('<br><br> ');
SMTP.AppendBody('you are being invited for an interview on this date '+FORMAT(Date));
SMTP.AppendBody('<br><br> ');
SMTP.AppendBody('and at this time' +FORMAT(Time));
SMTP.AppendBody('<br><br>');
SMTP.AppendBody('This is a Test From Microsoft Dynamics NAV. Please do not Reply');
SMTP.Send;
MESSAGE('Email Successfully Sent!');

It only send email after when the page is closed. And i want it work after opening a new record 

*This post is locked for comments

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: SMTP Mail

    try to debug and let me know the breakpoint for the error, try to move your code to onAfterGetCurrRecord trigger.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: SMTP Mail

    I did that and am having this message "the record that you are trying to open is not available". i deleted that page  and do it again but am still having the same message.

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: SMTP Mail

    You mean creating a new record from the page or retrieving every record from the page

    If creating then you need to add this in OnNewRecord trigger or you can also add in the table insert trigger.

    If you want to send an email for each retrieval of the record then you need to add this code in the OnAfterGetRecord trigger of the page.

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans