I have a simple trigger to send an email when a record is added to the table, but when the trigger is enabled the table will not populate and the email does not get sent. I am using SQL Server Mgt. Studio V18.8.
Below is the trigger.
USE [XXX_STD]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[Test]
ON [dbo].[Degas]
AFTER INSERT
AS
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'SQLMailProfile',
@recipients = '[email protected]',
@subject = 'xxx',
@body = 'xxx',
@body_format = 'HTML';
I was able to send a test database email successfully.