Solved

cdosys - not working in Windows2008

Posted on 2012-03-23
25
1,031 Views
Last Modified: 2012-03-30
Not using Exchange, just sending out emails from CDOSYS.
We moved from a Windows server 2003 to 2008 and now none of my email code works - using CDOSYS - nothing fancy.
SMTP installed an running - I know to look on IIS 6.
I Set the web site on IIS7 to use localhost.
Port's open.
No error messages in event viewer.
Detail Error message when running asp program:
An error occurred on the server when processing the URL. Please contact the system administrator.

If you are the system administrator please click here to find out more about this error.

and when I click here, it has absolutely nothing about anything relevant to the situation at all.
0
Comment
Question by:dcass
  • 17
  • 8
25 Comments
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 500 total points
ID: 37760107
This works on my Godaddy IIS7 account.  I found it somewhere and adapted it.

<%@ LANGUAGE = VBScript %>
<%  Option Explicit		%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>CDO-Email</title>
</head>
<body>
<h1>CDO-Email</h1>
<p>Godaddy demo code.</p>
<%
Dim sendUrl, smtpUrl, objConfig, objMail

sendUrl="http://schemas.microsoft.com/cdo/configuration/sendusing"
smtpUrl="http://schemas.microsoft.com/cdo/configuration/smtpserver"

' Set the mail server configuration
Set objConfig=CreateObject("CDO.Configuration")
objConfig.Fields.Item(sendUrl)=2 ' cdoSendUsingPort
objConfig.Fields.Item(smtpUrl)="youremailhost.com"
objConfig.Fields.Update

' Create and send the mail
Set objMail=CreateObject("CDO.Message")
' Use the config object created above
Set objMail.Configuration=objConfig
objMail.From="youremail@host.net"
objMail.ReplyTo="youremail@host.net"
objMail.To="theiremail@host.com"
objMail.Subject="This are the subject"
objMail.TextBody="And this are the bodybody."
objMail.Send
%> 
</body>
</html>

Open in new window

0
 

Author Comment

by:dcass
ID: 37760110
What does Godaddy have to do with localhost smtp?
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37760113
The point of my post was that CDOSYS does work with IIS7.  If you would post the basic version of your code that doesn't work, maybe somebody could help you.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:dcass
ID: 37760116
Do you mean to use "localhost" instead of "youremailhost.com"?
0
 

Author Comment

by:dcass
ID: 37760122
It doesn't work anyway - I'm missing something in the setup or something else - the code I have works, just not on this system.
CDOSYS.dll is installed - I checked.
0
 

Author Comment

by:dcass
ID: 37760124
Set myMail=CreateObject("CDO.Message")
    myMail.Subject="This is an email"
    myMail.From="mailbox@yourdomain.com"
    myMail.To="xx@xxxx.com"
    myMail.TextBody="Hello"
    myMail.Send
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37760128
You can try that.  One of the things that comes up with Windows 7 and possibly Server 2008 is that localhost is defined as an IPV6 address of '::1' instead of the IPV4 address of '127.0.0.1'.  If localhost doesn't work, try '127.0.0.1'.

Here http://forums.iis.net/t/1144383.aspx is a discussion of getting CDOSYS to work on IIS7 with some sample code.  And someone else said this http://forums.iis.net/p/1157046/1901343.aspx got it working for them on localhost.

5. in IIS7,  go to website/virtual directory, double click "SMTP E-mail", Click on "Deliver e-mail to SMTP server", check the "Use localhost" checkmark
0
 

Author Comment

by:dcass
ID: 37760141
Unfortunately neither of the links work.

Did this already:
5. in IIS7,  go to website/virtual directory, double click "SMTP E-mail", Click on "Deliver e-mail to SMTP server", check the "Use localhost" checkmark
0
 

Author Comment

by:dcass
ID: 37760143
Plus I'm not using aspx - just plain asp.
0
 

Author Comment

by:dcass
ID: 37760145
Also, I know ASP is installed and working properly.
SMTP is also installed and shows active.
Error occurs as soon as I try to create the object.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37760154
You've exhausted what little I know.  If you click on "Request Attention" above, you can get some others to look at your question.  It's late on Friday night and into Saturday morning here so it may take a while.
0
 

Author Comment

by:dcass
ID: 37760171
I don't have that button - maybe you can for me?
0
 

Author Comment

by:dcass
ID: 37760176
Also, the error occurs from the mymail.send - not the object creation.
I am new to windows 2008 - can't find any error msg in any log.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37760183
I ran into that error on another sample code on IIS7 because it didn't have the configuration section that comes first in my sample code above.  The code you posted above works fine on my Windows XP IIS 5.1 with SMTP.  It must be a standard demo somewhere.  But it's not good for IIS7 for some reason.
0
 

Author Comment

by:dcass
ID: 37760846
The configuration section gives an error - does that give you any clues?
Again, I can't find the exact error - don't know where to look - Event Viewer doesn't seem to have any errors that pertain to this.
0
 

Author Comment

by:dcass
ID: 37760851
One weird thing, on IIS on the web site, under ASP.NET it has SMTP E-mail, but it doesn't have it under IIS/ASP.
I've set up the SMTP E-Mail under ASP.NET - checked Deliver e-mail to SMTP server, but again I'm not sending it out via asp.net.
0
 

Author Comment

by:dcass
ID: 37760962
OK: this works for email but will not send out a text message, which I hope you know that is an email, so I'm very confused.
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "xx@xxxx.com"
objEmail.To = "xx@xxxx.com"
objEmail.Subject = "test"
objEmail.textbody = "test"
objEmail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
objEmail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send

but does NOT work for (which does work on Windows 2003):
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "xx@xxxx.com"
objEmail.To = "9999999999@email.uscc.net"
objEmail.Subject = "test"
objEmail.textbody = "test"
objEmail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
objEmail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
0
 

Author Comment

by:dcass
ID: 37760985
Here is the actual email - I'm thinking since it's going out from the server, it must be some kind of mismatch here for the cell phone companies not to deliver (of course I've replaced real numbers  for security purposes):

Received: (qmail 19367 invoked from network); 24 Mar 2012 16:25:43 -0000
Received: from unknown (HELO p3pismtp01-018.prod.phx3.secureserver.net) ([10.6.12.18])
          (envelope-sender <9999999999@email.uscc.net>)
          by p3plsmtp02-06.prod.phx3.secureserver.net (qmail-1.03) with SMTP
          for <9999999999@email.uscc.net>; 24 Mar 2012 16:25:43 -0000
X-IronPort-Anti-Spam-Result: ArAFAJD0bU9EWkXSTmdsb2JhbABDikSsdIEJAQEiS4IFBgUIKB0NLAUGJCQ0EAgGAgIDAQQbhUCCMBKdNpgFjgSCQWMEiFegOw
Received: from colo2-xxxxxxxxx-210.epconline.net (HELO CWEB) ([99.99.99.999])
  by p3pismtp01-018.prod.phx3.secureserver.net with ESMTP; 24 Mar 2012 09:25:12 -0700
Received: from CWEB ([127.0.0.1]) by CWEB with Microsoft SMTPSVC(7.5.7601.99999);
         Sat, 24 Mar 2012 11:25:12 -0500
thread-index: Ac0J2rAoOnkFdUNjTqqVyHedXZFHkw==
From: <9999999999@email.uscc.net>
To: <9999999999@email.uscc.net>
Date: Sat, 24 Mar 2012 11:25:12 -0500
Message-ID: <75439D3051F94A429998A0F91DAB6F28@CWEB>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7601.17609
Return-Path: 9999999999@email.uscc.net
X-OriginalArrivalTime: 24 Mar 2012 16:25:12.0655 (UTC) FILETIME=[B02815F0:01CD09DA]
X-Nonspam: None

test
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37761098
Can you send a regular email from another account like your Gmail account to <9999999999@email.uscc.net>?
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37761108
And can you use that code to send to a regular email account instead of a cell phone account?
0
 

Author Comment

by:dcass
ID: 37762085
Yes and yes.
I've read articles now about how 2008  is doing this on purpose - making it difficult to impossible to send out email and I guess the protocols are not right for cell phones.
It looks like I'll have to start all over and install Windows 2003.
I sure would like to find out if 2005 has the same problems, but I won't have time to do this kind of research all over again.  
Anyone know about 2005?
0
 

Author Comment

by:dcass
ID: 37762647
Good news - text messaging came through about 10-12 hours after sent.
They had "Delay" on them - is there a setting to not delay?
0
 

Accepted Solution

by:
dcass earned 0 total points
ID: 37762692
Now working perfectly - changed the code to use 127.0.0.1 instead of localhost.
Reset IIS6 to much shorter retry times (1 minute).
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "dc@xxxxxxxxxx.com"
objEmail.To = "dc@cxxxxxxxxxx.com;9999999999@email.uscc.net"
objEmail.textbody = "test"
objEmail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1"
objEmail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37763114
Thanks, glad you got it working.
0
 

Author Closing Comment

by:dcass
ID: 37786116
The last post is the final correct post.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

803 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