Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Major IIS MAIL Probleem ??? New CDO error :-(

Status
Not open for further replies.

Roel018

Programmer
Jun 12, 2002
30
NL
Dear Folks,

We are experiencing a huge problem over here, although we temporarily solved it now. We create applications which combine the power of ASP and FLASH MX with these cooperating closely together. For our web based forms (information/contact forms) we always used the code below (below error code). This has always worked just perfectly until a few days ago, when we received an error for every form we had.. When we execute the form, we get this error in our browser:

CDO.Message.1 error '80040220'
The "SendUsing" configuration value is invalid.
/asp/sendmails.asp, line 69

Line 69: Set objMail_Registrant = CreateObject("CDO.Message")


An example of the complete code we are using:


*********************************************

<%
dim strREmailAdminister, strR_Naam, strR_Emailadres, strR_Telefoonnummer, strR_Aantal, strR_Datum, strR_Tijd
strREmailAdminister="lunch@fictief-restaurant.nl"
strR_Naam=Request("r_naam")
strR_Emailadres=Request("r_emailadres")
strR_Telefoonnummer=Request("r_telefoonnummer")
strR_Aantal=Request("r_aantal")
strR_Datum=Request("r_datum")
strR_Tijd=Request("r_tijd")

dim HtmlStartTags, HtmlEndTags
HtmlStartTags = "<html><body>"
HtmlEndTags = "</body></html>"

dim objMail_Registrant
Set objMail_Registrant = CreateObject("CDO.Message")

Dim sendersname_Registrant
sendersname_Registrant = "Fictief Restaurant"
finalsendersname_Registrant = """" & sendersname_Registrant & """ <" & Trim(strREmailAdminister) & ">"

objMail_Registrant.To = Trim(strR_Emailadres)
objMail_Registrant.From = Trim(finalsendersname_Registrant)
objMail_Registrant.Sender = Trim(finalsendersname_Registrant)
objMail_Registrant.Subject = "Dank u voor uw reservering"
objMail_Registrant.HTMLBody = HtmlStartTags & "<FONT SIZE='2' FACE='ARIAL'><p>Hartelijk dank voor uw reservering bij BlABlA !<br>Wij zullen uw reservering zo spoedig mogelijk per E-mail of telefoon bevestigen.</p><p>U heeft gereserveerd voor: " & strR_Datum & " om " & strR_Tijd & " uur.</p><p>&nbsp;</p><p>Met vriendelijke groet,<br><br>Het Team van bla bla</p></font>" & HtmlEndTags

objMail_Registrant.Send

Set objMail_Registrant= Nothing
%>

*********************************************



This has always worked fine. We are using a Windows 2000 webserver now for years and are running IIS (of course) to handle the mail for example. The funny thing is (frustrating as well) is that these forms DO work when I add the next LARGE piece of code at the beginning (top) of my code (found it somewhere on MSDN site):


*********************************************
response.Expires = -1000
Const cdoSendUsingMethod = _
"Const cdoSendUsingPort = 2
Const cdoSMTPServer = _
"Const cdoSMTPServerPort = _
"Const cdoSMTPConnectionTimeout = _
"Const cdoSMTPAuthenticate = _
"Const cdoBasic = 1
Const cdoSendUserName = _
"Const cdoSendPassword = _
"
Dim objConfig ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields ' As ADODB.Fields

' Get a handle on the config object and it's fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields

' Set config fields we care about
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "smtp.inconel.nl"
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSMTPAuthenticate) = cdoBasic

.Update
End With


Set objMessage = Server.CreateObject("CDO.Message")

Set objMessage.Configuration = objConfig

*********************************************


AND NOW IT WORKS !!!! :S ...

Now have I searched for information about updates on IIS, SMTP or ASP etc but I can't find any announcements of changes therein which could explain this need to add code... I don't get why I have to add the above lines now all a suddenly !!

My question is, if this is just me (maybe this only happens to my own form) or that there's another cause... Could some1 please explain this to me ?????
Thnx !!!!

Gr
ROEL
 
Quite frankly, I am not real sure why your code worked without this bit:

Code:
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields

' Set config fields we care about
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "smtp.inconel.nl"
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSMTPAuthenticate) = cdoBasic

.Update
End With

Maybe somebody can explain that.
You need it to specify the port, which as far as I know, has always been 25 and the email server your email program will be running on.

The CDOSys email program is for windows 2k and xp only.

*and* you don't need the following piece of code:

Code:
response.Expires = -1000
Const cdoSendUsingMethod = _
"[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing"[/URL]
Const cdoSendUsingPort = 2
Const cdoSMTPServer = _
"[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver"[/URL]
Const cdoSMTPServerPort = _
"[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport"[/URL]
Const cdoSMTPConnectionTimeout = _
"[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"[/URL]
Const cdoSMTPAuthenticate = _
"[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"[/URL]
Const cdoBasic = 1
Const cdoSendUserName = _
"[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusername"[/URL]
Const cdoSendPassword = _
"[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendpassword"[/URL]

Those are the libraries required to run your email code.

Just replace themw with this line of code:

Code:
<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows XP Library" -->

and you will be fine
 
One more thing, even though the library says:

"CDO for Windows XP Library", it works for windows 2k also.
 
Actually, CDOSYS is only available on Windows 2000 and Windows Server 2003 as pointed out by the first link I have posted below. There are vast differences in between CDOSYS and CDONTS, these links will hopefully help you understand where the problem may lie. Hope this helps a bit.

LF






"As far as the laws of mathematics refer to reality, they are not certain; as far as they are certain, they do not refer to reality."--Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top