Thursday, 6 January 2011

Send email via Database Mail from command line

I use this from batch files to show jobs scheduled in windows have completed.

osql -E -d databasename -S servername -Q "EXEC msdb.dbo.sp_send_dbmail @profile_name='mail profile' , @recipients='sql_admin@mydomain.co.uk' , @body='message body' , @subject='Alert!' , @importance='High' " 

No comments: