Solved

cdosys - not working in Windows2008

Posted on 2012-03-23
25
1,020 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 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 500 total points
Comment Utility
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
Comment Utility
What does Godaddy have to do with localhost smtp?
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
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
 

Author Comment

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

Author Comment

by:dcass
Comment Utility
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
Comment Utility
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 82

Expert Comment

by:Dave Baldwin
Comment Utility
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
Comment Utility
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
Comment Utility
Plus I'm not using aspx - just plain asp.
0
 

Author Comment

by:dcass
Comment Utility
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 82

Expert Comment

by:Dave Baldwin
Comment Utility
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
Comment Utility
I don't have that button - maybe you can for me?
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:dcass
Comment Utility
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 82

Expert Comment

by:Dave Baldwin
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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 82

Expert Comment

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

Expert Comment

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

Author Comment

by:dcass
Comment Utility
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
Comment Utility
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
Comment Utility
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 82

Expert Comment

by:Dave Baldwin
Comment Utility
Thanks, glad you got it working.
0
 

Author Closing Comment

by:dcass
Comment Utility
The last post is the final correct post.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Email signatures have numerous marketing benefits. Here are 8 top reasons to turn your email signature into a marketing channel.
Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

771 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now