We can send the mail using execute SQL task in the package. For sending the mail we need to use sp_send_dbmail.
Before using Sp_send_dbmail we need to create a profile.
Read hear: Configure Database mail in SQL server
I have created a profile named [Bagi mail]
Sp_send_dbmail
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Bagi Mail',
@recipients = 'bageshkumarbagimsbi@gmail.com',
@body = 'Hello',
@subject = 'Execute sql task',
@exclude_query_output = 1
|
We can set profile name, recipients, and body and subject name using variables.
Now I am taking execute SQL task.
Creating the configure manager.
Click ok. Now I am running this package.
Package executed successfully.
Now we will see the mailbox.
See the mail body.