Solved

Problem with CDONTS ***** ERROR The "SendUsing" configuration value is invalid. *****

Posted on 2004-04-28
14
1,261 Views
Last Modified: 2010-05-18
**************QUESTION*****************
I have the simple code given below.  It is giving me the following error.  Please tell me the resolution

****************CODE*******************
Set cdoConfig = CreateObject("CDO.Configuration")  
Set cdoMessage = CreateObject("CDO.Message")  
 
With cdoMessage
        Set .Configuration = cdoConfig
        .From = "mtaj@ekinsystems.com"
        .To = "mtaj@ekinstems.com"
        .Subject = "Sample CDO Message"
        .TextBody = "This is a test for CDO.message"
        .Send
End With
 
Set cdoMessage = Nothing  
Set cdoConfig = Nothing  

****************ERROR****************
CDO.Message.1 error '80040220'

The "SendUsing" configuration value is invalid.


0
Comment
Question by:tgatif
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 2
  • +2
14 Comments
 
LVL 6

Expert Comment

by:MannSoft
ID: 10940052
I have the same problem here.  On my production server, CDO.Message works fine.  On my test machine, I get the error you've shown.  I never really looked deep into the problem, but if I had to guess it's probably because on my test machine there is no SMTP server, but on my production server there is.  So on the production server it uses the SMTP server from the same machine, and on my test server, it has to be told where to send to.

The reason I never looked for the real problem is because I found CDONTS.NewMail worked on both machines, so I just started using it instead.  If that's not an option, you could look at this old post:

http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20780859.html
0
 
LVL 31

Expert Comment

by:alorentz
ID: 10940094
You definitely need an SMTP server, and if it's not on the local machine you will need to use configuration.  If you have SMTP running with IIS on local machine, which you should, you don't need configuration:

Default settings work fine...

Set cdoMessage = CreateObject("CDO.Message")  
 
With cdoMessage
        .From = "mtaj@ekinsystems.com"
        .To = "mtaj@ekinstems.com"
        .Subject = "Sample CDO Message"
        .TextBody = "This is a test for CDO.message"
        .Send
End With
 
Set cdoMessage = Nothing  


0
 

Author Comment

by:tgatif
ID: 10940445
What kind of configurations do I need
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 

Author Comment

by:tgatif
ID: 10940461
Please write the code for the configurations and their default values (if possible) other wise mention it.
0
 
LVL 31

Expert Comment

by:alorentz
ID: 10940471
Like I said, none...

Do you have the SMTP server on the webserver...or do you need to use SMTP realy on a nother server?
0
 
LVL 31

Expert Comment

by:alorentz
ID: 10940597
Again, CDO is already programmed to use default configuration, so yu don't need to write any configuration...
0
 
LVL 1

Expert Comment

by:planetgrafx
ID: 10941651
*********FIRST USE THIS************************
Validate that CDONTS.NewMail is installed

*********TESTOBJECT.ASP***********************

<% @ Language="VBScript" %>
<% Option Explicit %>
<%
' there are a number of objects that come with IIS4
' these are put in the array that's declared below
Dim theInstalledObjects(10)

theInstalledObjects(0) = "MSWC.AdRotator"
theInstalledObjects(1) = "MSWC.BrowserType"
theInstalledObjects(2) = "MSWC.NextLink"
theInstalledObjects(3) = "MSWC.Tools"
theInstalledObjects(4) = "MSWC.Status"
theInstalledObjects(5) = "MSWC.Counters"
theInstalledObjects(6) = "IISSample.ContentRotator"
theInstalledObjects(7) = "IISSample.PageCounter"
theInstalledObjects(8) = "MSWC.PermissionChecker"
theInstalledObjects(9) = "SoftArtisans.FileUp"
theInstalledObjects(10) = "CDONTS.NewMail"

Function IsObjInstalled(strClassString)
 On Error Resume Next
 ' initialize default values
 IsObjInstalled = False
 Err = 0
 ' testing code
 Dim xTestObj
 Set xTestObj = Server.CreateObject(strClassString)
 If 0 = Err Then IsObjInstalled = True
 ' cleanup
 Set xTestObj = Nothing
 Err = 0
End Function
%>

<HTML>
<HEAD>
<TITLE>Test of installed objects</TITLE>
</HEAD>
<BODY>

Enter the ProgId or ClassId of the component you want to test in the textbox below. If you leave it empty, the default
components will be tested.

<FORM action=<%=Request.ServerVariables("SCRIPT_NAME")%> method=post>
<input type=text value="" name="classname" size=40>
<INPUT type=submit value=Submit>
<INPUT type=reset value=Reset>
</FORM>

<%
Dim strClass
strClass = Trim(Request.Form("classname"))
If "" <> strClass then
  Response.Write strClass & " is "
  If Not IsObjInstalled(strClass) then
    Response.Write "<strong>not installed</strong>"
  Else
    Response.Write "installed!"
  End If
  Response.Write "<P>" & vbCrLf
Else
  ' default: list all components that should be installed
%>

<TABLE BORDER=0>
<%
Dim i
For i=0 to UBound(theInstalledObjects)
  Response.Write "<TR><TD>" & theInstalledObjects(i) & "</TD><TD>"
  If Not IsObjInstalled(theInstalledObjects(i)) Then
    Response.Write "<strong>not installed</strong>"
  Else
    Response.Write "installed!"
  End If
  Response.Write "</TD></TR>" & vbCrLf
Next
%>
</TABLE>

<%
End If
%>

</BODY>
</HTML>

****************THEN USE THIS**************************
DO NOT Leave the FROM field blank or it wont come to your email address

****************TESTMAIL.ASP***************************
<%
If Request.Form.Count > 0 Then
    For I = 1 to Request.Form.Count
        Body = Body & Request.Form.Key(I) & " " _
               & Request.Form.Item(I) & vbCRLF
    Next
   
strTo = Request("to")
strFrom = Request("from")
strSubject = Request("subject")
strBody = Request("body")
   
   
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From =strFrom
objCDOMail.To = strTo
objCDOMail.Subject = strSubject
objCDOMail.Body = strBody
objCDOMail.Send
Set objCDOMail = Nothing


    Response.Write "E-Mail Sent!"
End If
%>
<html>
<head>
<title>E-mailer</title>
</head>

<body>

<table border="0" cellpadding="2" width="620">
  <form method="POST" action="<%= Request.ServerVariables("SCRIPT_NAME") %>">
      <tr>
      <td><b><font size="2" face="Verdana"> E-mail&nbsp;From</font></b></td>
      <td><input type="text" name="from" size="30"></td>
    </tr>
    <tr>
      <td><b><font size="2" face="Verdana">E-mail&nbsp;To</font></b></td>
      <td><input type="text" name="to" size="30"></td>
    </tr>
    <tr>
      <td><b><font size="2" face="Verdana">Subject</font></b></td>
      <td><input type="text" name="subject" size="45"></td>
    </tr>
    <tr>
      <td valign="top"><b><font size="2" face="Verdana">Body</font></b><p>&nbsp;</p>
      <p>&nbsp;</td>
      <td><textarea rows="15" name="body" cols="50"></textarea></td>
    </tr>
    <tr>
      <td align="center" colspan="2">
      <p align="center"><b><font size="2" face="Verdana"><input type="submit" value="Send E-Mail"></font></b></td>
    </tr>
  </form>
</table>

</body>

</html>



****************IF THE ABOVE DOESN'T WORK**************************
Validate that SMTP is working

http://www.iis-resources.com/modules/news/article.php?storyid=5


BTW: What OS is the Machine? Is it 2000, XP, 2003 ?





0
 

Author Comment

by:tgatif
ID: 10941666
But the code is giving me error.  The error said that "Send Using Configuration is Invalid"
0
 
LVL 31

Expert Comment

by:alorentz
ID: 10941718
It's really not productive to dispute what I tell you...have you tried my code.  The error you had was because you initailize configuration but never added any configuration information.

Just use my code...NO CONFIGURATION
0
 

Author Comment

by:tgatif
ID: 10942391
Beg your pardon!

I used your code.  I just copied and pasted it and again giving me configuration error
0
 
LVL 31

Expert Comment

by:alorentz
ID: 10942418
So then your SMTP is not set up properly....that is what I asked before.

See here:  CDO with Config...

http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20779650.html?query=cdo+configuration&searchType=topic
0
 
LVL 21

Accepted Solution

by:
ap_sajith earned 500 total points
ID: 10944415
Try this code.. see if it works...


<%
Call SendMailCDOSYS("you@domain.com","you1@domain.com","TestMail","this is a test mail",False,"localhost")
' ** YOU CAN SPECIFY ANY MAIL SERVER AS THE LAST PARAMETER AS LONG AS IT IS VALID. **

Sub SendMailCDOSYS(strFrom,strTO,strSubject,strMailBody,blnHTML,sMailServer)
On Error Resume Next
      Dim objCDOConf,objCDOSYS
      ' ** CREATE THE E-MAIL SERVER OBJECT **
      Set objCDOSYS = Server.CreateObject("CDO.Message")
      Set objCDOConf = Server.CreateObject ("CDO.Configuration")

      ' ** SET AND UPDATE FIELDS PROPERTIES **
      With objCDOConf
            ' ** OUT GOING SMTP SERVER **
            .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = sMailServer
            ' ** SMTP PORT **
            .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport")  = 25
            ' ** CDO PORT **
            .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
            ' ** TIMEOUT **
            .Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
            .Fields.Update
      End With

      ' ** UPDATE THE CDOSYS CONFIGURATION **
      Set objCDOSYS.Configuration = objCDOConf

      With objCDOSYS    
            ' ** WHO THE E-MAIL IS FROM **
            .From = strFrom

            ' ** WHO THE E-MAIL IS SENT TO **
            .To = strTo
                        
            ' ** THE SUBJECT OF THE E-MAIL **
            .Subject = strSubject
             
            ' ** SET THE E-MAIL BODY FORMAT (HTMLBody=HTML TextBody=Plain) **
            If blnHTML = True Then
            .HTMLBody = strMailBody
            Else
            .TextBody = strMailBody
            End If
             
            ' ** SEND THE E-MAIL **
            .Send
      End with                    
        
      ' ** CLOSE THE SERVER MAIL OBJECT **
      Set objCDOSYS = Nothing
End Sub
%>

Also, Your error might be caused because you are creating your configuration object before setting the message object. Try reversing that in your code as well.

Also, as Alorentz already pointed out, make sure that the SMTP is configured and your machine is connected to the network.

Hope this helps...

Cheers!!
0
 
LVL 31

Expert Comment

by:alorentz
ID: 10944727
@ap_sajith - I provided a link to configuraion settings...why did you feel the need to post same thing again?
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 10946659
@alorentz, I just posted a tried and tested code that i use in my apps. I was in a hurry and didnt really check out the URl that you posted. Besides,i think he would get an error because he tried setting the configuration before setting the message object. Sorry if i offended you in any way. BTW... great going...keep up the good work!.

Cheers!!
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question