This wonderful utility provided by Microsoft to not use SQL Mail with SQL Server 2000 to send SMTP email. I usually compile this into master database so it can be used by all databases and agent jobs. This is a sample of how to send and email because I am forever looking for an example.
USE [master]
GO
DECLARE @return_value int
DECLARE @body_text varchar(3000);
SET @body_text = 'Body Header' + char(13)
SET @body_text = @body_text + 'Message line one
'
SET @body_text = @body_text + 'Message line two
'
print @body_text;
EXEC @return_value = [dbo].[usp_send_cdosysmail]
@from = N'noreply.server_name@generac.com',
@to = N'user_name@server_name.com',
@subject = N'Success Email',
@body = @body_text,
@smtpserver = N'mail.server.com',
@bodytype = N'htmlbody'
SELECT 'Return Value' = @return_value
GO
No comments:
Post a Comment