How to auto send mai by using this function sp_send_dbmaill

I have the following:
can anyone explain what are these functions for (@profile_name ,@query @attach_query_result_as_file = 0,@query_result_header ,
@query_result_width ,
@exclude_query_output and
@query_result_separator)?  and I couldnt find this script when execute (msdb.dbo.sp_send_dbmai)l?  

I have the following:
 
EXEC msdb.dbo.sp_send_dbmail
@recipients=N'email@address',
@body='None', 
@subject ='Subject',
@body_format = 'HTML',
@profile_name = 'Profile',
@query ='set nocount on; exec dataDayStrip 657,4,7; set nocount off;', 
@attach_query_result_as_file = 0,
@query_result_header = 1,
@query_result_width = 1000,
@exclude_query_output = 1,
@query_result_separator = ';'

Open in new window

risk-xAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jogosCommented:
0
risk-xAuthor Commented:
After I try to execute the following code. There is a error message. what is this error message about?
Thx

Msg 14636, Level 16, State 1, Procedure sp_send_dbmail, Line 95
No global profile is configured. Specify a profile name in the @profile_name parameter.
EXEC msdb.dbo.sp_send_dbmail @recipients='tcyee@risk-x.com.my',
    @subject = 'fail download',
    @body = 'testing',
    @body_format = 'HTML' ;

Open in new window

0
jogosCommented:
follow link for more info

[ @profile_name = ] 'profile_name'
Is the name of the profile to send the message from. The profile_name is of type sysname, with a default of NULL. The profile_name must be the name of an existing Database Mail profile. When no profile_name is specified, sp_send_dbmail uses the default private profile for the current user. If the user does not have a default private profile, sp_send_dbmail uses the default public profile for the msdb database. If the user does not have a default private profile and there is no default public profile for the database, @profile_name must be specified.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
risk-xAuthor Commented:
Thx for the explanation! you are really helpful......Thx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.