Basic emails can be sent using below user-defined stored procedure. Before you use this stored procedure you have to create a profile and account using the Configure Database Mail Wizard which can be accessed from the Configure Database Mail menu of the Database Mail in Management section in SQL Server instance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
USE [Master]; GO CREATE PROCEDURE [dbo].[SendEmailNotification] @To nvarchar(4000), @Subject nvarchar(4000), @Body nvarchar(4000), @Attachment nvarchar(4000) = " " AS EXECUTE msdb.dbo.sp_send_dbmail @Recipients = @To, @Subject = @Subject, @Body = @Body, @File_Attachments = @Attachment |
Leave a Comment