0

We had to rebuild our SQL server instance over this week and have restored every database including Master and other system settings, but our database mail does not seem to be working. All of the queued emails are sitting in Unsent and the mail queue is listed as Inactive. I've tried restarting the queue as well, although some other posts make it sound like Inactive is the default state for when it is not in use at that moment. We are using version 15.0.2116.2

I've been unable to find anything in the error log and the only indicator that it is not working besides the obvious lack of an email is the sysmail_event_log which used to have records in this order:

Activation Successful; Activation Successful; DatabaseMail process is started; Mail Successfully Sent; Mail Successfully Sent; DatabaseMail Process is shutting down.

Now all we get are the first two activation successful messages.

After reviewing the Databasemail.exe.config it lists .net version 4.6, however we have 4.7 so I'm not sure if that could be a cause. I know previous versions needed .net v3.5. It's also worth noting that the email stored procedures worked perfectly before having to reinstall the sql server instance and restore the databases. The database mail profile is still the same as well, and the sql server service account that was previously used.

Edit: After deleting all accounts and profiles linked to the database mail feature and starting that configuration over from scratch we did get the test mail working, in some of our stored jobs we now run into an error message "Msg 14607, Level 16, State 1, Procedure msdb.dbo.sysmail_verify_profile_sp, Line 42 [Batch Start Line 0] profile name is not valid"

Edit2: The latest error was because the scheduled tasks called for a specific profile name in their steps.

8
  • Did you reconfigure the Database Mail or assumed it was configured after restoring the System Databases? What happens when you right click the Database Mail and use the option "Send Test E-Mail..."? Commented Jul 26, 2024 at 17:23
  • @Ronaldo We checked the Database Mail profile and confirmed all of the settings, when selecting Send Test E-Mail, I put in my email address and waited without receiving the email. I can see it in the sysmail_unsentitems table. Only logs created in the sysmail_event_log are the two Activation successful events created by sa Commented Jul 26, 2024 at 17:29
  • Could you Send a test email with PowerShell? There are other troubleshooting steps if that's not conclusive. Please, follow them and update your question with each test executed and its output. Commented Jul 26, 2024 at 17:45
  • @Ronaldo following those steps I received "Exception calling "Send" with "4" argument(s): "The remote certificate is invalid according to the validation procedure" We use a wildcard certificate for our exchange certificate and it is still valid at this time, and was used previously before the instance rebuild. Commented Jul 26, 2024 at 17:55
  • I changed mail servers to a more common used name for our mail server, both take you to OWA with the same certificate, but that one succeeded in sending, updated Database Mail with a new login to that mail server which worked in powershell. Send Test E-Mail resulted in an unsent email still Commented Jul 26, 2024 at 18:12

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.