web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Send test email in UAT fails with A non-recoverable error occurred during a database lookup

(0) ShareShare
ReportReport
Posted on by 1,457

We have a problem with emails failing on UAT. It works on my Dev box and in production.

First it was a no certificate error but that was due to after a refresh from production the SMTP settings username and password was not re-entered.

However now I get the error 'A non-recoverable error occurred during a database lookup'.

I am currently just testing the email with the 'Send test email' option on the Email parameters > Test email tab. I get the same error on my new function, so can just as well use the standard option to try and find the issue.

I changed my Dev box to access the UAT database for debugging and have stepped through the code.

It happens on this call: SendMessage method on the "smtpProxy" class.

I cannot see what it does in the SendMessage because it looks like it is a call to a function inside a Microsoft DLL.

While stepping through the code I could see the following:

1) The SysMailerFactory, method ensureSecurityProtocol, shows that the ForceLegacyMailerSecurityBehaviorFlightName returns a NO, so flight name 'ForceLegacyMailerSecurityBehavior' is not enabled.

I can't even find this flightname in the feature management list. Not on Production either. I know flight numbers don't copy over with a refresh from production. but there is no way for me to see if it is turned on in Production if it isn't even in the feature management list of features.

I can see that ServicePointManager, SecurityProtocol is equal to SecurityProtocolType::Tls12

Then with the following piece of code it indicates that SysMailerSmtpMailKitFeatureV2 is enabled because it runs smtpProxy instead of smtpClient..

***

if (SysMailerSmtpMailKitFeatureV2::isEnabled())
{
.....
}

***

Again, there is no way for me to find this flight name in production feature management to see what it is set to. I assume it will be the same because I found a comment in one of the classes that smtpClient is obsolete and that MailKit must be used instead. This is standard code, so I assume Microsoft won't have run the obsolete code.

I also found this link: Common Errors When Sending Email With Mailkit - .NET Core Tutorials (dotnetcoretutorials.com)
The port number is 587 on the SMTP settings and I have changed the Specify if SSL is required from YES to NO. It made no difference if it is set to Yes or No.

So what is needed to fix the error: 'A non-recoverable error occurred during a database lookup'
The Test email is working fine in production. So something is missing in UAT. Because we do not have custom here, I can just assume something is not copied over from production to UAT on a DB refresh.

Any help to get this working is much appreciated.

I have the same question (0)
  • Verified answer
    Retha Profile Picture
    1,457 on at

    I found my error.

    The email SMTP parameters wasn't set up correctly on UAT. After the refresh the outgoing server must have defaulted to smtp.office365.com and that is not our outgoing server name.  I assumed the test environment will use different values than production, thus taking that server name as being correct, which was not the case.

    So after I added the correct settings, the emails flowed again.

  • Suggested answer
    Dean Stegmiller Profile Picture
    on at

    Hi Retha,

    Thanks for updating your post with the answer.  For future reference to anyone that finds this topic, please note there are a number of things that have to be reconfigured when moving databases as noted in the section of this article:

    https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/database/dbmovement-scenario-general-refresh#reconfigure-environment-specific-settings 

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 456 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans