Link to home
Start Free TrialLog in
Avatar of risk-x
risk-x

asked on

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

Avatar of jogos
jogos
Flag of Belgium image

Avatar of risk-x
risk-x

ASKER

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

ASKER CERTIFIED SOLUTION
Avatar of jogos
jogos
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of risk-x

ASKER

Thx for the explanation! you are really helpful......Thx