| Author |
Topic |
|
bigknoxy
Starting Member
3 Posts |
Posted - 2006-03-24 : 16:26:34
|
| When I test this with Query Analyzer I get this:The command(s) completed successfully then0x800401F3 ODSOLE Extended Procedure Invalid class stringthis is my code. Help would be great.CREATE Procedure sp_SMTPMail2@ToAddress varchar(100),@FromAddress varchar(100),@Subject varchar(200),@Body varchar(8000)AS SET NOCOUNT ONDECLARE @object int,@hr int,@property varchar(255),@return varchar(255),@src varchar(255), @desc varchar(255),@Mailserver varchar(100)SET @Mailserver = 'mailserver.com'-- First, create the object.EXEC @hr = master..sp_OACreate 'Persits.MailSender', @object OUTIF @hr <> 0BEGIN-- Report any errorsEXEC master..sp_OAGetErrorInfo @object, @src OUT, @desc OUT SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@descGOTO END_ROUTINEENDELSE-- An object is successfully created.BEGIN-- Set propertiesEXEC @hr = master..sp_OASetProperty @object, 'Host', @MailserverIF @hr <> 0 GOTO CLEANUPEXEC @hr = master..sp_OASetProperty @object, 'From', @FromAddressIF @hr <> 0 GOTO CLEANUPEXEC @hr = master..sp_OASetProperty @object, 'Subject', @SubjectIF @hr <> 0 GOTO CLEANUPEXEC @hr = master..sp_OASetProperty @object, 'Body', @BodyIF @hr <> 0 GOTO CLEANUPEXEC @hr = master..sp_OAMethod @object, 'AddAddress', NULL, @ToAddressIF @hr <> 0 GOTO CLEANUPEXEC @hr = master..sp_OAMethod @object, 'Send', NULLGOTO CLEANUPENDCLEANUP:-- Check whether an error occurred.IF @hr <> 0BEGIN-- Report the error.EXEC master..sp_OAGetErrorInfo @object, @src OUT, @desc OUT SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@descEND-- Destroy the object.BEGINEXEC @hr = master..sp_OADestroy @object-- Check if an error occurred.IF @hr <> 0 BEGIN-- Report the error.EXEC master..sp_OAGetErrorInfo @object, @src OUT, @desc OUT SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@descENDENDEND_ROUTINE:RETURNGO |
|
|
sachinsamuel
Constraint Violating Yak Guru
383 Posts |
Posted - 2006-03-27 : 07:35:36
|
| Its seems like SMTP service is not installed on the server where you executing this stored procedure.RegardsSachinDon't sit back because of failure. It will come back to check if you still available. -- Binu |
 |
|
|
bigknoxy
Starting Member
3 Posts |
Posted - 2006-03-27 : 09:41:22
|
| I'm sorry but I am really new to this...How would I check to see if it is installed?I believe the server has outlook installed would that not be it?Thanks |
 |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2006-03-27 : 17:47:26
|
quote: Originally posted by sachinsamuel Its seems like SMTP service is not installed on the server where you executing this stored procedure.
What about the error message gives you this idea ??????I'd ignore that little bit of advice.Invalid class string implies that the COM object isn't registered. Did you run an installer for the Persists component ? Or did you use regsvr32 to register it ?Can you write some VBS to test the component works on the server ?Damian"A foolish consistency is the hobgoblin of little minds." - Emerson |
 |
|
|
svicky9
Posting Yak Master
232 Posts |
|
|
sachinsamuel
Constraint Violating Yak Guru
383 Posts |
Posted - 2006-03-28 : 00:44:42
|
| Invalid class string error occurs when the you are trying create an instance or object of a component which is not registered.To register SMTP, go to add remove programe. Then add remove components. This will list down all the windows component. The checked ones are those which are installed and the unckecked ones are those which are not in installed. Click Internet Information services(IIS) and then click Details button. Check if SMTP service is checked or not. If not then install and the try running your script.RegardsSachinDon't sit back because of failure. It will come back to check if you still available. -- Binu |
 |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2006-03-28 : 01:14:42
|
quote: Originally posted by sachinsamuel Invalid class string error occurs when the you are trying create an instance or object of a component which is not registered.
Is there an echo in here ?Damian"A foolish consistency is the hobgoblin of little minds." - Emerson |
 |
|
|
bigknoxy
Starting Member
3 Posts |
Posted - 2006-03-29 : 09:57:04
|
| Thanks for the help guys... I was trying to use the dll above and also 'SMTPsvg.Mailer' and I registered them but just wouldn't work for me for some reason, so I ended up using CDO when I found it was already registered on the server and I wouldn't have to put it on myself and CDO worked for me the very first time...Here is the link if anyone is interested:http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=670&lngWId=5 |
 |
|
|
|