In this article I will explain with an example, how to send email with body format as text in email using sp_send_dbmail Stored Procedure in SQL Server.
This article is applicable to following SQL Server versions i.e. 2008, 2008R2, 2012, 2014, 2016, 2017, 2019 and 2022.
 
 

Unblocking the sp_send_dbmail Stored Procedure in SQL Server

Firstly, you will need to unblock the Stored Procedure sp_send_dbmail used for sending emails using SQL Server.
In order to unblock the Stored Procedure, please refer my article Unblock dbo.sp_send_dbmail in SQL Server.
 
 

Configure SQL Server for sending emails

Then, you will need to configure SQL Server for sending emails from Database.
In order to configure SQL Server, please refer my article Configure SQL Server for sending emails.
 
 

Sending email with body format text in SQL Server

Once the SQL Server is configured for sending emails, the SQL Server is now ready to send emails with body format as text.
To send an email, simply copy, paste, edit (according to your settings) and execute the following SQL query.
DECLARE @messageBody NVARCHAR(1000) = '<b>Happy Birthday Mudassar Khan</b>.<br />'
   + 'Many happy returns of the day.'
   + '<br /><br />ASPSnippets Team'
EXEC msdb.dbo.sp_send_dbmail
    @profile_name = 'Makenzi_Email_Profile'
   ,@recipients = 'makenzi.exc@gmail.com'
   ,@subject = 'Birthday Wishes'
   ,@body = @messageBody
   ,@body_format = 'HTML'
   ,@importance = 'HIGH'
GO
 
Once executed, the following messages will appear which confirms, your email has been queued.
Send email with body format text in SQL Server
 
 

Checking Emails Status email sent with query results as attachment

Finally, to find the status of emails whether they are not sent, sent or failed, please refer my article Find email sent status.
 
 

Screenshot

 
Send email with body format text in SQL Server
 
 

Downloads