SQL Server Stored Procedure to Send Email
You're missing a comma after the @body
line, which is throwing off your declarations.
Add it here:
@Body varchar(8000), -- HERE
@MailServer varchar(100) = 'localhost'
Don't use sp_oa_family to send mail, there is already a built-in solution with SQL Server: Database Mail. Simply configure Database Mail properly on your server, then call sp_send_dbmail
.
There's a comma missing in your parameters :
@Body varchar(8000), ---- HERE
@MailServer varchar(100) = 'localhost'