Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Email from SQL Server
Message
From
25/10/2006 23:31:48
 
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01156883
Message ID:
01164626
Views:
11
Hi:
I've tried one of your given reference(http://www.orcsweb.com/articles/sendmailsql.aspx) and it works good on it and it delivers directly to the recepients via msoutlook. Please see below the following code.
------------------
create procedure vsp_am_sendcdosysmail @Body varchar(50) = " "
as
begin
declare @iMsg int, @hr int, @source varchar(255), @description varchar(500), @output varchar(1000)

/* Create the CDO.Message Object */
execute @hr = sp_OACreate 'CDO.Message', @iMsg OUT

/* Configuring the Message Object
This is to configure a remote SMTP server.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_schema_configuration_sendusing.asp */
execute @hr = sp_OASetProperty @iMsg, 'Configuration.fields ("http://schemas.microsoft.com/cdo/configuration/sendusing").Value','2'

/* This is to configure the Server Name or IP address.
Replace MailServerName by the name or IP of your SMTP Server. */
execute @hr = sp_OASetProperty @iMsg, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpserver").Value', 'nkmx2'

/* Save the configurations to the message object. */
execute @hr = sp_OAMethod @iMsg, 'Configuration.Fields.Update', null

/* Set the e-mail parameters. */
execute @hr = sp_OASetProperty @iMsg, 'To', 'janc@aufil.com.ph'
execute @hr = sp_OASetProperty @iMsg, 'From', 'janc@aufil.com.ph'
execute @hr = sp_OASetProperty @iMsg, 'Subject', 'sql server alert'

/* If you are using HTML e-mail, use 'HTMLBody' instead of 'TextBody'. */
execute @hr = sp_OASetProperty @iMsg, 'TextBody', @Body
execute @hr = sp_OAMethod @iMsg, 'Send', NULL

/* Sample error handling. */

if @hr <>0
select @hr
begin
execute @hr = sp_OAGetErrorInfo NULL, @source OUT, @description OUT
if @hr = 0
begin
select @output = ' Source: ' + @source
print @output
select @output = ' Description: ' + @description
print @output
end
else
begin
print ' sp_OAGetErrorInfo failed.'
return
end
end

/* Do some error handling after each step if you have to.
Clean up the objects created. */
execute @hr = sp_OADestroy @iMsg
end
GO
------------------
however when I try to run this morning I'm afraid I've encounter an error and please see below:
-----------------------------------------
(1 row(s) affected)


Description: The message could not be sent to the SMTP server. The transport error code was 0x800ccc15. The server response was not available
-----------------------------------------
do you have any idea on this? Thanks.

Kind Regards,
Jan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform