Thanks for the info so now I have this
EXEC msdb.dbo.sp_send_dbmail
@profile_name='DBMail',
@recipients = 'mygmail@gmail.com',
@query = 'select FName as first,
LName as last
from Test.dbo.client where LName = ''wilson'' ''
for xml path(''Referral'')
ROOT(''CLUB'')',
@body = 'The stored procedure finished successfully.',
@subject = 'Automated Success Message',
@query_result_header = 1,
@exclude_query_output = 1,
@append_query_error = 1,
@attach_query_result_as_file = 1,
@query_attachment_filename = 'qry.xml'
But still getting an error of:
db01_ssagent. profile name is not valid [SQLSTATE 42000] (Error 14607
Account name is DBMail
Sent a test and received it??
Thanks yet again!!