Sending Email (Html Code) - using SMTP

sunnyksunnyk Posts: 264Member
Hello, We created a New report and wrote the attached Code to send Email certain data to one user.
6h4v8uja8cml.png

Attached is the SMTP setting on our NAV server.
xpi41dfpt0x9.png

However, we executed the report, we got the error
Microsoft Dynamics NAV

The SMTP mail system returned the following error: "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [KL1PR0601CA0015.apcprd06.prod.outlook.com]".

Answers

  • thomasronnthomasronn Posts: 1Member
    The user in smtp setup can't send on behalf of the sender you have in SMTPMail.CreateMessage()

    Try set the sender in SMTP.Message() to NAV_Notification[what's behind red box] to test if can can send at all. if success then set up permissions to send as or send on behalf in office365
  • JohnHunterJohnHunter Posts: 41Member
    Try "SMTP Mail Setup" / "Test Email Setup" ?
Sign In or Register to comment.