Basit Khan

Basit Khan

  • 1.3k
  • 336
  • 115.5k

Send Email in SQL

Aug 16 2015 4:40 AM
Dear,
i created a trigger on CustomerCall when call inserted & Assign to particular user i want to send email.
Below is the working trigger only how to get the Assign user email address from User Table
User-Table
us_No
Us_Name
Us_Password
Us_Email
I want when the customer call assign to particular user take that email address and put it in below trigger.
alter TRIGGER CallInserted
ON [dbo].[CustomerCall]
FOR INSERT
AS
BEGIN
SET NOCOUNT ON;
IF EXISTS (SELECT * FROM inserted)
BEGIN
EXEC msdb.dbo.sp_send_dbmail
// here how to get receipent email from User table
@recipients = 'recipients',
@profile_name = 'SendEmailCM',
@subject = 'Notification',
@body_format = 'html',
@body = 'body'
END
END
GO

Answers (1)