Normally an Email iin SQL Server using the stored proc "msdb.dbo.sp_send_dbmail" .
A geneneric Format of sending an email using the above procedure is
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Test SQL Mail',
@subject = 'Test SQL Mail,
@recipients = @ToList,
@copy_recipients = @CCList,
@from_address = 'raksha.r.hegde@gmail.com,
@body_format = 'HTML',
@file_attachments =@FilePath,
@body = @body;
end
To send an SQL Mail with high importance one more parameter, @importance has to be added as below:
One of the below 3 values can be set:
High
Low
Normal
Default Value is Normal.
To send an email as High Priority Email, we can use the below format
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Test SQL Mail',
@subject = 'Test SQL Mail,
@importance = 'High', @recipients = @ToList,
@copy_recipients = @CCList,
@from_address = 'raksha.r.hegde@gmail.com,
@body_format = 'HTML',
@file_attachments =@FilePath,
@body = @body;
No comments:
Post a Comment