1
votes

I am unable to send the email through the form because of the following error. I assume that the form doesn't work because of the depricated CDO? I'm not sure, but also I am not sure how to fix this problem.

CDO.Message.1 error '80040220'

The "SendUsing" configuration value is invalid.

/thankyou.asp, line 24

The Code

<%
Set objMail = Server.CreateObject("CDO.Message")

objMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
objMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
objMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMail.Configuration.Fields.Update

objMail.From = Request.Form("Email") ' change this to an email address
objMail.To = "[email protected]" ' change this to your email address
objMail.Subject = "name Questions/Comments" ' change this to your subject
'Set the e-mail body format (HTMLBody=HTML TextBody=Plain) 

'Set the e-mail body format (HTMLBody=HTML TextBody=Plain) 
objMail.HTMLBody = "<font size=3 face=verdana>"
objMail.HTMLBody = objMail.HTMLBody & "<strong>" & "From: " & "</strong>" & Request.form("Name") & "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<strong>" & "Email: " & "</strong>" & Request.Form("Email") & "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<strong>" & "Phone: " & "</strong>" & Request.Form("Phone") & "<br>" & "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<strong>" & "Questions/Comments: " & "</strong>" & "<br>" & Replace(Request.Form("Details"), vbCrLf, "<br />") & "<br>" & "<br>" & "</font>"
'objMail.HTMLBody = objMail.HTMLBody & "<em>" & "Sent at " & Now() & "</em>" & "</font>"

objMail.Send()

Set objMail = Nothing*

%>

I don't have the access to the physical server and I cannot change the permissions myself.

http://blogs.msdn.com/b/akashb/archive/2010/05/24/error-cdo-message-1-0x80040220-the-quot-sendusing-quot-configuration-value-is-invalid-on-iis-7-5.aspx

Any ideas how can I fix this piece of code to make it work again?

I have tried this: http://forums.iis.net/t/1146477.aspx?The+SendUsing+configuration+value+is+invalid+

Changing SendUsing to 1.

And setting up google snmp to send the emails without much results. Any information would be helpful.

1
look at this posting I think you are missing one configuration.Fields msdn.microsoft.com/en-us/library/ms873037%28EXCHG.65%29.aspxMethodMan
DJ, I get the same error with field "objMessage.Configuration.Fields.Item("schemas.microsoft.com/cdo/configuration/smtpserverport") = 25"HelpNeeder
If you're using a gmail smtp server then you should use port 587 rather than 25 You'll also need username and password in your config fields paulsadowski.com/wsh/cdo.htmJohn

1 Answers

2
votes

replace your code with this:

<%
Set cdoConfiguration = Server.CreateObject("CDO.Configuration") 

With cdoConfiguration 
  .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" 
  .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
  .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
  .Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 
  .Fields.Update 
End With 

Dim tmpStr
tmpStr = ""

tmpStr = "<font size=""3"" face=""verdana"">"
tmpStr = tmpStr & "<ul>"
tmpStr = tmpStr & "<li><strong>" & "From: " & "</strong>: " & Request.form("Name") & "</li>"
tmpStr = tmpStr & "<li><strong>" & "Email: " & "</strong>: " & Request.form("Email") & "</li>"
tmpStr = tmpStr & "<li><strong>" & "Phone: " & "</strong>: " & Request.form("Phone") & "</li>"
tmpStr = tmpStr & "<li><strong>Questions/Comments</strong>:<br/>"
tmpStr = tmpStr & Replace(Request.Form("Details"), vbCrLf, "<br />")
tmpStr = tmpStr & "</li>"
tmpStr = tmpStr & "</ul>"
tmpStr = tmpStr & "<p>Sent at " & Now() & "</p>"
tmpStr = tmpStr & "</font>"

Set newMailObj           = Server.CreateObject("CDO.Message") 
newMailObj.Configuration = cdoConfiguration 
newMailObj.Subject       = "name Questions/Comments" 
newMailObj.From          = Request.Form("Email")
newMailObj.To            = "[email protected]" 
newMailObj.HTMLBody      = tmpStr 

newMailObj.Send 

set newMailObj = nothing     
set cdoConfiguration = nothing
%>

and let us know if it works like that, cause if it does, your code (or at least the part you paste to us) is not correct...

and, by the way, if you're using localhost I'm almost sure that the server configuration is not necessary... It is obligatory if you use a remote server like smtp.server.com