I do not understand why every example I have seen has the schema from microsoft for the namespace. What is it for? Is it really sending something by looking at Microsoft servers?
How do I use CDO with Exchange with vbscript
I would post my code but it and all examples all have the same thing:
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")= cdoSendUsingPort
I don't want to put the microsoft schema in there. I just want to send it to my Exchange or SMTP server. Thanks.
The namespaces are there because they uniquely identify the properties within the object;
From the MSDN article Fields.
It's almost exactly the same principal as XML Namespaces, or even namespaces in a language like C#
They aren't actually connecting to Microsoft at all; indeed, try typing the URL into a browser, and you will get a 404 error.
It's just the rather inelegant syntax for setting the properties that you need to set in order to connect to your exchange server.
For example, to set the server your code should connect to for sending mail, you set the property
smtpserver
. Internally, to reach this property, the assembly will map this onto the URIhttp://schemas.microsoft.com/cdo/configuration/smtpserver
A C# component for sending mail might ask you to set
SmtpMail.Server
. However, remember, to create SmtpMail, you would have had to look in the namespaceSystem.Web.Mail
- so the fully qualified path to the property isSystem.Web.Mail.SmtpMail.Server
Here, however, the language is far more elegant - the using statement allows us to be in the context for creating the object, which reduces the amount of typing. Remember, if you really wanted to, in C#, you could do:Which is more verbose.
In my opinion, the URI syntax is ungainly, however, at the time, it was a proposed solution to the problem of uniquely distinguishing things with the same name that could mean something different. Some people used it. A lot of people didn't. Remember, this code is over a decade old!