The attached document describes how to manually configure Database Mail and how is can be used to send a notification when a Negative Quantity situation exists.
Database Mail can optionally be configured by using the script listed below without having to process the manual steps.
EXEC sp_configure 'Show Advanced Options', 1 RECONFIGURE EXEC sp_configure 'Database Mail XPs', 1; GO RECONFIGURE GO ---- -- Create a Database Mail profile EXECUTE msdb.dbo.sysmail_add_profile_sp @profile_name = 'Notifications', @description = 'Profile used for sending outgoing notifications.' ; GO -- Grant access to the profile to the DBMailUsers role EXECUTE msdb.dbo.sysmail_add_principalprofile_sp @profile_name = 'Notifications', @principal_name = 'public', @is_default = 1 ; GO -- Create a Database Mail account EXECUTE msdb.dbo.sysmail_add_account_sp @account_name = 'SQLMail', @description = 'SQLMail', @email_address = 'SQLMail@EthosSolutions.net', ---Input your email settings @display_name = 'Acclamare SQL', @mailserver_name = 'mail.ethossolutions.net', ---Input your email settings @port = 26, @enable_ssl = 0, @username = 'SQLMail@EthosSolutions.net', ---Input your email settings @password = 'Pepsi1960!' ; ---Input your email settings GO -- Add the account to the profile EXECUTE msdb.dbo.sysmail_add_profileaccount_sp @profile_name = 'Notifications', @account_name = 'SQLMail', @sequence_number =2 ; GO --- To send a test email EXEC msdb.dbo.sp_send_dbmail @profile_name = 'Notifications', @recipients = 'doug.perkinson@gmail.com', ---input an address to send a test email to @body = 'The database mail configuration was completed successfully.', @subject = 'Automated Success Message'; GO ---- Troubleshooting URL -- https://www.sqlshack.com/configure-database-mail-...