Last active
March 28, 2019 22:16
-
-
Save petesql/1a8cc5fca398f10882cf45557f80f5e7 to your computer and use it in GitHub Desktop.
send_dbmail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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