Created
June 2, 2016 15:16
-
-
Save davops/fcca671e46fa3160dce8ea5f4e8dfb49 to your computer and use it in GitHub Desktop.
Query to search for an existing email profile in SQL & send an email using it
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
--Find a prexisting email profile to be inserted into the "@profile_name" variable below | |
EXEC msdb.dbo.sysmail_help_profile_sp; | |
--Define the text you will email | |
DECLARE @body NVARCHAR(MAX) | |
SET @body = 'Whatever you want to send yourself' | |
--Send the email using the email profile found | |
EXEC msdb.dbo.sp_send_dbmail | |
@profile_name = 'Administrator Profile', | |
@recipients = 'administrator@youremail.com', | |
@body = @body, | |
@subject = 'Test Email'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment