Let’s create a new table
CREATE TABLE [dbo].[Users]( [UserId] [int] NOT NULL, [UserName] [varchar](100) NOT NULL ) ON [PRIMARY]
Now to create the trigger for the new entries
CREATE TRIGGER [dbo].[NewUser_Email] ON [dbo].Users AFTER INSERT AS BEGIN SET NOCOUNT ON; DECLARE @UserId INT SELECT @UserId = INSERTED.UserId FROM INSERTED declare @body varchar(500) = 'User with ID: ' + CAST(@UserId AS VARCHAR(5)) + ' inserted.' EXEC msdb.dbo.sp_send_dbmail @profile_name = 'Primary Profile' ,@recipients = 'santhosh@gmail.com' ,@subject = 'New User Added' ,@body = @body ,@importance ='HIGH' END
Before doing this make sure you have your DB Mail configured on your SQL Server. You should be changing the @profile_name to whatever you have configured and and @recipients to the list of emails you need the alerts.
Once this is done, you should be receiving a mail alert or each entry into the table.
INSERT INTO [USERS] VALUES (1, 'AAA')
Check here to know how to Alert me when SQL Server Drive Space is low.