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 |
|
iminore
Posting Yak Master
141 Posts |
Posted - 2006-07-18 : 11:50:13
|
| I'm sending an email via CDO using sp_OASet...All's fine when I do it via the local SMTP account but I want to do it via another server. I've done it in an ASP file and it works even when SMTP is stopped on the local machine.The problem in SQL comes down to this code:declare @MailConfigID intexec @hresult = sp_OACreate 'CDO.Configuration', @MailConfigID OUTexec @hresult = sp_OASetProperty @MailConfigID, 'Fields.item("http://schemas.microsoft.com/cdo/configuration/sendusing")', 2exec @hresult = sp_OASetProperty @MailConfigID, 'Fields.item("http://schemas.microsoft.com/cdo/configuration/smtpserver")', 'xserver'exec @hresult = sp_OAMethod @MailConfigID, 'Fields.Update', NULLexec @hresult = sp_OASetProperty @MailID, 'Configuration', @MailConfigIDI check @hresult each step and all is fine until the last setting of the Configuration property - then I get -2147352571So the updating of the mail object's configuration property is not working.Any ideas? |
|
|
iminore
Posting Yak Master
141 Posts |
Posted - 2006-07-21 : 10:47:08
|
| I've now found the answer (thanks to Microsoft).Adding the fields.item values to the configuration needed .value so - ...sendusing").value','2'And all values are passed as strings.Now works beatifully. No SMTP - but can send emails! |
 |
|
|
|
|
|