msdb..sp_send_dbmail does not work with @query only with @body I'm trying to execute the following:

msdb.dbo.sp_send_dbmail
--@body='Hi from sql server in a sproc'
@query='select 1'
,@recipients='mkohn@***.com'
,@subject = 'Test'


When I uncomment @body line, and comment the query... line it works.
With the query it returns:


  
    Msg 22050, Level 16, State 1, Line 0
    Failed to initialize sqlcmd library with error number -2147467259.
  


I have a developer edition on my own workstation and it all works no problem

I tried:


Installing .Net 3.5
Adding myself to db_owner and [DatabaseMailUserRole]
Adding [NT Service\MSSQLSERVER] to db_owner and [DatabaseMailUserRole]
Same as above with [NT SERVICE\SQLSERVERAGENT]
Have you created a mail profile and assigned an account to the profile?  See the how to by Pinal Dave @ SQL Authority

First create a mail profile, assign the profile a valid account, and enable  Database Mail XP's

Once those steps are done and tested, test your script 

    msdb.dbo.sp_send_dbmail
    @profile_name = 'ProfileName'
    --@body='Hi from sql server in a sproc'
    @query='select 1'
    ,@recipients='mkohn@***.com'
   ,@subject = 'Test'