|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Mailing witch cdosys (NOT SQL MAIL!!)
Hey, i've got this stored procedure which i would like to use for sending email in sql server WITHOUT using the sql mail feature (because it use mapi). I found this sproc on the net, so it ain't my code. When i execute the command, it gives me no errors. But as you've guessed by name, the mail didn't arrived. I have all the priviliges i need on the mail server. Can anyone PLZ help me out here, tnx!
---------------- sproc ---------------- CREATE Procedure sp_SMTPMail @SenderName varchar(100), @SenderAddress varchar(100), @RecipientName varchar(100), @RecipientAddress varchar(100), @Subject varchar(200), @Body varchar(8000), @MailServer varchar(100) = '***************' AS SET nocount on declare @oMail int --Object reference declare @resultcode int EXEC @resultcode = sp_OACreate 'SMTPsvg.Mailer', @oMail OUT if @resultcode = 0 BEGIN EXEC @resultcode = sp_OASetProperty @oMail, 'RemoteHost', @mailserver EXEC @resultcode = sp_OASetProperty @oMail, 'FromName', @SenderName EXEC @resultcode = sp_OASetProperty @oMail, 'FromAddress', @SenderAddress EXEC @resultcode = sp_OAMethod @oMail, 'AddRecipient', NULL, @RecipientName, @RecipientAddress EXEC @resultcode = sp_OASetProperty @oMail, 'Subject', @Subject EXEC @resultcode = sp_OASetProperty @oMail, 'BodyText', @Body EXEC @resultcode = sp_OAMethod @oMail, 'SendMail', NULL EXEC sp_OADestroy @oMail END SET nocount off GO -------------------------- end sproc -------------------------- -------------------------- execute command -------------------------- exec sp_SMTPMail @SenderName='me', @SenderAddress='me@somewhere.com', @RecipientName = 'Someone', @RecipientAddress = 'someone@someplace.com', @Subject='SQL Test', @body='Hello, this is a test email from SQL Server' -------------------------- end exec -------------------------- |
|
#2
|
|||
|
|||
|
I found the solution
No need to help me anymore, i just found a perfect solution. For anyone who cares: visit http://www.sqldev.net/xp/xpsmtp.htm#Description
bye |
|
#3
|
||||
|
||||
|
Stumbled across this today while looking for something else: http://support.microsoft.com/defaul...;312839&sd=tech
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Mailing witch cdosys (NOT SQL MAIL!!) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|