[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1009
  • Last Modified:

error from CDO.Message

I run below VBscript very well on my laptop(Windows XP). After installing on a Windows 2008 server, it show a error message when running.

Any idea about this? How to fix it?

Thanks very much

----------

strmainbody = "Please check connection"
      set objMessage = CreateObject("CDO.Message")
      objMessage.Subject = "Connection failed"
      objMessage.From = "Alert"
      objMessage.To = "MyName@MyCompanyName.com"
      objMessage.TextBody = strmainbody
      objMessage.Send

2.JPG
0
howruaz9
Asked:
howruaz9
  • 8
  • 6
  • 2
5 Solutions
 
Dave BaldwinFixer of ProblemsCommented:
See all of the examples on this page: http://www.w3schools.com/asp/asp_send_email.asp  Your simple version may work locally but the more complete version down the page is needed in some circumstances.
0
 
howruaz9Author Commented:
Please review result. I used following vbs

Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="mymail@mydomain.com"
myMail.To="someone@somedomain.com"
myMail.TextBody="This is a message."
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.server.com"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing

3.JPG
0
 
Dave BaldwinFixer of ProblemsCommented:
You did put your own email addresses and server name in that example first, right?  If you need to 'authenticate' when you send email, check out the 'password' and 'username' section on this page: http://www.paulsadowski.com/wsh/cdo.htm
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
CodeCruiserCommented:
>objMessage.From = "Alert"
That needs to be a valid email address I think and the user needs to have the permission to send using that address.
0
 
howruaz9Author Commented:
Thank DaveNaldwin and CodeCruiser,

I'm sure email address, server name, pw, username are correct. The problem is this script works well on my laptop, but don't work on windows 2008 server.

Is there anyone know this issue?


For "objMessage.From", you can put anything in there.
0
 
Dave BaldwinFixer of ProblemsCommented:
Where is the server?  Is it a hosted server like on Godaddy?
0
 
howruaz9Author Commented:
This server in our intranet.

I have tested this VBscript on other laptops. Some worked and some didn't work. I guess some configurations on Windows are different; but I don't know where to check.

Any idea about this?

Thanks
0
 
Dave BaldwinFixer of ProblemsCommented:
I found this:

"CDOSYS.DLL is not available in Windows Server 2008 R2 Core Edition. You can copy it from the full installation of Windows Server 2008 R2."

Here is a download but you need to read the System config notes: http://www.microsoft.com/downloads/en/details.aspx?familyid=e17e7f31-079a-43a9-bff2-0a110307611e&displaylang=en
0
 
howruaz9Author Commented:
Thanks very much

I'll try to install it.
0
 
howruaz9Author Commented:
I run "ExchangeMapiCdo.EXE and checked CDOSYS.DLL existed. but still got 80040220 error message.

Your help is highly appreciated.  
0
 
Dave BaldwinFixer of ProblemsCommented:
Here qare the acceptable values for 'Send Using' http://msdn.microsoft.com/en-us/library/ms873037%28v=exchg.65%29.aspx  What are you using?
0
 
howruaz9Author Commented:

Thnaks DaveBaldwin

but I didn't know how to use "cdoSendUsingPickup (1)" in below VBscript

strmainbody = "Please check connection"
      set objMessage = CreateObject("CDO.Message")
      objMessage.Subject = "Connection failed"
      objMessage.From = "Alert"
      objMessage.To = "MyName@MyCompanyName.com"
      objMessage.TextBody = strmainbody
      objMessage.Send
0
 
Dave BaldwinFixer of ProblemsCommented:
If you don't have a SMTP server or at least one that is recognized on your machine, you probably can't use that simple version.   You may have to use the last example on this page http://www.w3schools.com/asp/asp_send_email.asp and put in the address of a SMTP server that you have permissions to use.
0
 
howruaz9Author Commented:
Thank DaveBaldwin

I have tried the last example, but it didn't work.

I think the reason that VBscript works on my laptop, but doesn't work on windows 2008 server is that windows 2008 server miss some email related component, or service, or file. It's environment problem; isn't VBscript problem.

Does any expert know this?
0
 
howruaz9Author Commented:
After running "ExchangeMapiCdo.EXE and checked CDOSYS.DLL existed. but still got 80040220 error message.

0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

  • 8
  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now