What do schemas do

  • Thread starter Thread starter Paul C
  • Start date Start date
The "schema" links you see in the code
(http://schemas.microsoft.com/cdo/configuration/) are URI's (Uniform
Resource Identifiers) and don't point to specific URL's. In other words they
are merely a namespace that are used to guarantee uniqueness. If you try to
go to any of these links you will find that they don't exist - hence you can
use them offline.

Here are some code examples:

Sending a TEXT Message

<%
Dim iMsg
Dim iConf
Dim Flds
Dim strText

' set the CDOSYS configuration fields to use port 25 on the SMTP server
Const cdoSendUsingPort = 2

set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")

Set Flds = iConf.Fields

With Flds
..Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =
cdoSendUsingPort
..Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"mail.mydomain.com"
..Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
= 10
..Update
End With

strText = "This is a sample email"
strText = strText & "sent from the Web Site"
strText = strText & "using CDOSys"

With iMsg
Set .Configuration = iConf
..To = "(e-mail address removed)"
..From = "(e-mail address removed)"
..Subject = "This is from a remote SMTP server."
..TextBody = strText
..Send
End With

Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
%>

Sending an HTML formatted Message

<%
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML

' set the CDOSYS configuration fields to use port 25 on the SMTP server
Const cdoSendUsingPort = 2

set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")

Set Flds = iConf.Fields

With Flds
..Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =
cdoSendUsingPort
..Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"mail.mydomain.com"
..Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
= 10
..Update
End With

strHTML = "<HTML>"
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<b> Hello there! </b></br>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"

With iMsg
Set .Configuration = iConf
..To = "(e-mail address removed)"
..From = "(e-mail address removed)"
..Subject = "This is from a remote SMTP server."
..HTMLBody = strHTML
..Send
End With

Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
%>
 
Hi Thanks for replying
I am a bit confused, I don't understand "guarantee uniqueness" what
difference will it make if they where to be left out?
Paul M
 
Thanks david
This seems complicated when something like jmail sends emails without all
of this. Is there a reason that cdosys is better than the send component of
jmail?
Thanks for bearing with me
Paul M
 
I didn't say it was better. I personally like it but there are a lot of
different ways to send mail out there (JMail, CDOSYS, ASPEmail etc). It's a
preference thing. Use whichever one you like (as long as your web host
supports / offers it). if it does the job for you that's all that's
important.
 
Back
Top