Skip to content

Instantly share code, notes, and snippets.

@petesql petesql/send_dbmail.sql
Last active Mar 28, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.