Skip to content

Instantly share code, notes, and snippets.

@petesql
Last active March 28, 2019 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petesql/1a8cc5fca398f10882cf45557f80f5e7 to your computer and use it in GitHub Desktop.
Save petesql/1a8cc5fca398f10882cf45557f80f5e7 to your computer and use it in GitHub Desktop.
send_dbmail
-- Send database mail.
DECLARE @get_date DATETIME = GETDATE()
DECLARE @body_text VARCHAR(MAX)
= 'This email was sent from SQL Sever at '
+ CAST(@get_date AS VARCHAR)
+ ' .'
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'local',
@recipients = 'email@outlook.co.uk',
@subject = 'This is a test email.' ,
@importance = 'Low',
@body = @body_text,
@body_format = 'Text'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment