SQL SERVER 2005 mail function
|
|
|
Question / Problem
|
How anyone can send mail through sql server 2005.
|
Solution
|
first enable database mail service through sql server surface area manager.
then go to sql server management studio
open management
then
Database mail and configure it with server and id.
and check it as a default mail id
then use this code to send mail
declare @body1 varchar(100)
@body1 varchar(100)set @body1 = 'Server :'+@@servername+ ' My First Database Email '
@body1 = 'Server :'+@@servername+ ' My First Database Email 'EXEC msdb.dbo.sp_send_dbmail @recipients='reciption mail id here',
msdb.dbo.sp_send_dbmail @recipients='reciption mail id here',@subject = 'My Mail Test',
= 'My Mail Test',@body = @body1,
= @body1,@body_format = 'HTML' ;
= 'HTML' ;
|
Applies to |
|
Microsoft SQL Server 2005
|
Rank It |
|