One of our offices has an application that utilizes databasemail to send emails from the application to users listed in the application's user directory.
In their live environment, the emails are sent without issue. On their training environment, the emails are not sent. On the application side, the settings to send emails are the same, and the database on the training side is a copy of the live database from a recent restore.
I've tried checking the databasemail logs, but the only events are event_type of information, mostly "DatabaseMail process is started", usually followed 10-20 minutes later by a "DatabaseMail process is shutting down" message.
I'm at a loss for why messages for the live database are working while the training database isn't, even though both databases are on the same SQL Server instance and the applications both live on the same server.
Your live and test environments must have the same permissions to run Database Mail service. Check that your test user has
DatabasemailUserRole
formsdb
database. As well as any other permissions which could be needed to run some part of your application, e.g. stored procedures in test database queryingmsdb
, etc.