| Dart Home | PowerTCP Mail for ActiveX | Custom Development | Reply | PowerTCP Mail for ActiveX Topics | Forums |
| Author | Forum: PowerTCP Mail for ActiveX Topic: Creating SMTP object in T-SQL |
| rgbradley3 rbradley@sepialine.com From: San Francisco, CA USA Posts: 2 Member Since: 10/04/02 |
posted October 4, 2002 3:26 PM Hello, Does anyone have experience creating an SMTP object from within MS SQL Server (T-SQL), using sp_OACreate? If so, sample code would be greatly appreciated. Thanks! -Ray |
| rgbradley3 rbradley@sepialine.com From: San Francisco, CA USA Posts: 2 Member Since: 10/04/02 |
posted October 4, 2002 4:26 PM All, I answered my own question. For those interested, here's how it goes: --TODO: declare and populate your own @mailTo, @mailFrom, @subject and @body varchar variables DECLARE @object int DECLARE @hr int DECLARE @mailServer varchar(255) --look up the mail server SET @mailServer = 'mail.mycompany.com' --create the mail object EXEC @hr = sp_OACreate 'Dart.Smtp', @object OUT IF @hr <> 0 RETURN --log into the mail server EXEC @hr = sp_OAMethod @object, 'Login', NULL, @mailServer IF @hr <> 0 RETURN --send the message EXEC @hr = sp_OAMethod @object, 'QuickSend', NULL, @mailTo, @mailFrom, @subject, @body --log out from SMTP EXEC @hr = sp_OAMethod @object, 'Logout', NULL --destroy the object EXEC @hr = sp_OADestroy @object |
| Reply | PowerTCP Mail for ActiveX Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|