Forum Discussion

msvidya11's avatar
msvidya11
Occasional Contributor
14 years ago

CDO Configuration error in Windows 7

Hi,



I am using the CDO configuration to send a test mail to my email account using JScript using Testcomplete. It works perfectly in WinXP, whereas, throws an error in Windows 7. 



Error Message: "The SendUsing Configuration value is invalid".  

PFA the screenshot. Please guide me to resolve this issue





Below is the code I am using to send the test mail:



<Code>



function sendEmail(smtpServerName,smtpAccountName,fromAddress,toAddress,subject) {






  try {


  


  var objMessage = new ActiveXObject("CDO.Message")


  var cdoConfig = new ActiveXObject("CDO.Configuration")






  cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServerName;


  cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25


  cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1


  cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1


  cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpaccountname") = smtpAccountName;


  cdoConfig.Fields.Update();  


   


  objMessage.Subject = subject;


  objMessage.From = fromAddress; 


  objMessage.To = toAddress;


  objMessage.TextBody = "This is a test mail."


  objMessage.Fields.Update();


  objMessage.Send();


  


  }


  catch(exception) {   


    throw exception;


  }    


}



function sendTestMail(){

sendEmail("mail.domain.com","mail.domain.com",<From Address>,<To Address>,"Test Mail");



}

</Code>





Thanks in advance,

Vidya

17 Replies


  • Hi Egbe,



    The image you sent shows that the EnvelopeFields field of a CDO.Message object is unavailable at a moment. However, this does not mean a problem with sending a message. Does the script work? Can you send the message? If the message is not sent, please let me know what exactly error occurs when the script is executed.







  • egbea's avatar
    egbea
    Occasional Contributor
    Thanks David.  Though there is error message. However, no mail is sent which makes me think the that "i]EnvelopeFields field of a
    CDO.Message object is unavailable at a moment"  was the problem.

  • Hi Egbe,



    Contact the administrator of your mail server (mail.sciemetric.com) and ask to check server logs in order to get information whether your code was able to connect to the server. Let me know if this helps to find the cause of the problem.







  • msvidya11's avatar
    msvidya11
    Occasional Contributor
    Hi,



    Thanks for the suggestion David.

    I have tried adding the authentication to the SendEmail() function( as suggested by David on 14 Oct 2011, 07:30 AM), but of no use. I am still getting the same error message. "SendUsing configuration is invalid" while sending the test mail in Win7.  Please let us know if there are any other ways to resolve the issue.

     

    Thanks,

    Vidya



    PS: The same function works fine in a WinXP machine and a test mail is triggered.
  • vgummala's avatar
    vgummala
    Occasional Contributor
    Hey guys,



    Do we have any other technique to send mails from Windows7 without using CDO.Message? or any using any .NET dll's or using any java script functions.



    Thanks in advance
  • Hi Vidya,



    Could you please send us your project along with the failed execution results using the Contact Support form? I want to take a look at your actual code and the error message.