How do I compile SQL email but not send?

42 Views Asked by At

In SQL Server, it's possible to send an email via Outlook.

I want to compile an email but have it automatically sent. The code below automatically queues the email and sends to the recipients. I need to make adjustments on the email before sending it out. These adjustments account for dates. Is that possible?

EXEC msdb.dbo.sp_send_dbmail  
@profile_name = 'Email Team',
@recipients='[email protected]',
@subject='Monthly Report',
@body='Good morning, reports have ran for these dates: ',
@body_format='HTML',
@from_address='<[email protected]>'

As a result, I get this:

Mail (Id: 3549) queued.
0

There are 0 best solutions below