• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 734
  • Last Modified:

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

0
risk-x
Asked:
risk-x
  • 2
  • 2
1 Solution
 
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
 
risk-xAuthor Commented:
Thx for the explanation! you are really helpful......Thx
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now