Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
hiranjan11
Starting Member
2 Posts |
Posted - 2009-01-28 : 04:46:12
|
Hi All,I try to send mail through this sprocs --Create Procedure [dbo].[sp_SMTPMail] @SenderName varchar(100), @SenderAddress varchar(100), @RecipientName varchar(100), @RecipientAddress varchar(100), @Subject varchar(200), @Body varchar(8000)AS SET nocount on declare @oMail int --Object reference declare @resultcode int EXEC @resultcode = sp_OACreate 'CDONTS.NewMail', @oMail OUT if @resultcode = 0 BEGIN EXEC @resultcode = sp_OASetProperty @oMail, 'From', @SenderAddress EXEC @resultcode = sp_OASetProperty @oMail, 'To', @RecipientAddress EXEC @resultcode = sp_OASetProperty @oMail, 'Subject', @Subject EXEC @resultcode = sp_OASetProperty @oMail, 'Body', @Body EXEC @resultcode = sp_OAMethod @oMail, 'Send', NULL EXEC sp_OADestroy @oMail END SET nocount off// Command completed successfully.After that call the Sprocs --exec sp_SMTPMail @SenderName='Ranjan', @SenderAddress='xyz@gmail.com',@RecipientName = 'YouAgain', @RecipientAddress = 'xyz@gmail.com',@Subject='SQL Mail Test', @body='This is a test message from SQL Server. Smile! It worked.'// Command completed successfully but mail doesn't transfer to mailIdPlease any one help me . If any know about other way to transfer mail through sqlserver 2005 then help me.ThanksRanjan |
|
|
|
|
|
|