Solved

cdosys - now not working in Windows2008 after working

Posted on 2012-03-28
12
640 Views
Last Modified: 2012-08-14
I had email working out of Windows 2008 - now the simple code below is no longer working - gets error message on the send statement:
<%  
Set objEmail=CreateObject("CDO.Message")
objEmail.From="dc@xxxxxxx.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") = "127.0.0.1"
            objEmail.Configuration.Fields.Item _
             ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
            objEmail.Configuration.Fields.Update
              objEmail.Send
%>
The only reason I know it's on the send statement is that it runs without an error until I put that line in the code.
I had smtp set up to go out without authentication, then noticed hackers using it.
Now, I need to figure out why smtp stopped working with no changes being made, and then I need to figure out how to send with either basic authentication or Windows authentication.  Basic asks for a domain instead of a password.  Windows won't let me select Authenticated Users - it's not in the list.  Plus I need the configuration.fields.item statement for either or both.
Apparently, everyone in the world can use my smtp but me!
0
Comment
Question by:dcass
  • 6
  • 6
12 Comments
 
LVL 28

Expert Comment

by:sammySeltzer
ID: 37778366
what error exacly are you getting?
0
 

Author Comment

by:dcass
ID: 37778374
It is a 64 bit system.  I uninstalled and reinstalled cdosys.dll on both with regsrv32.
Someone mentioned setting up a 32 bit application pool, but I'm not sure how to do that.
Corrected code (still error on send statement):
<%  
Set objEmail=CreateObject("CDO.Message")
objEmail.From="dc@xxxxxxx.com"
objEmail.Subject = "test"
objEmail.textBody = "test"
objEmail.To="dc@xxxxxx.com"
               
            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 28

Expert Comment

by:sammySeltzer
ID: 37778390
What version of iis?

If iis6, then run this on command line prompt as is and it will enable 32bit mode.

cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 “true”

sorry pushed the button too soon.

For iis, try this:

Below is how you do it from IIS7 manager:

Right click on the Application Pool and select “Advanced Settings…” or select the same from the Actions pane after selecting the Application pool
Change the “Enable 32-bit Applications” to True (if you want the application pool to spawn in a 32-bit mode)
Click OK

or commandline use this:

appcmd set apppool /apppool.name:MyAppPool32bit /enable32BitAppOnWin64:true
0
 

Author Comment

by:dcass
ID: 37778455
cmd didn't work - running it on DOS at C:\ prompt, right?
0
 

Author Comment

by:dcass
ID: 37778460
smtp does run on IIS6 on 2008.
iis runs of IIS7
0
 
LVL 28

Accepted Solution

by:
sammySeltzer earned 500 total points
ID: 37778479
Sorry, I missed that it is windows 2008 .

Well, you don't have to do it using command prompt.

Just follow this:

Right click on the Application Pool and select “Advanced Settings…” or select the same from the Actions pane after selecting the Application pool
Change the “Enable 32-bit Applications” to True (if you want the application pool to spawn in a 32-bit mode)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 28

Expert Comment

by:sammySeltzer
ID: 37778488
This is actually more intuitive.

http://www.winservermart.com/HowTo/How_To_Switch_32bit_and_64bit_mode_in_IIS7.aspx

Hopefully, that's your issue.

Our classic asp app runs on windows server 2008 with emails going out every 2 days with no problems at all.
0
 

Author Comment

by:dcass
ID: 37778902
Did that and found that someone outside sent out 120,000 emails that were going out, but I still can't send one out.  Took a while to clear all that out.
I still get an error on the send statement.
Can you send me a code example?
0
 
LVL 28

Expert Comment

by:sammySeltzer
ID: 37779013
It is still not very clear to me how a hacker hacked into your email.

But here is the code we use.

Notice that we used Anonymous authentication.

          <!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
          NAME="CDO for Windows XP Library" -->
      <%

	'code for sending email.  This will one work on windows windows xp or higher
	Dim iMsg
	Set iMsg = CreateObject("CDO.Message")
	Dim iBp
	Dim Flds
	Dim iConf
	Set iConf = CreateObject("CDO.Configuration")
	Set Flds = iConf.Fields
	Flds(cdoSendUsingMethod)  = cdoSendUsingPort
	Flds(cdoSMTPServer)       = "servername"
	Flds(cdoSMTPServerPort)   = 25
	Flds(cdoSMTPAuthenticate)     = cdoAnonymous ' 0
	Flds.Update
	With iMsg
	 Set .Configuration = iConf
	     .From = ""&firstname&"" & ""&lastname&"" & "<" & email & ">"
	     .To = "sales@doamin.com"
	     .Subject     = "Employment Application"
	     .TextBody    = "First Name = "& fName &""& VbCrLf & "Last Name = "& lName &""& VbCrLf &"Address = "& Address &"" & VbCrLf & "City = "& City &""& VbCrLf & "State = "& state &" "& VbCrLf & "Zip Code = "& zip &""& VbCrLf &"Phone = "& phone &"" & VbCrLf & "Email = "& Email &" "& VbCrLf & "Position = "& position &""& VbCrLf & "Start Date = "& sDate &""& VbCrLf &"Applied Here Before? = "& appliedHere &""& VbCrLf & "What you like Most about this place = "& likeMost &" "& VbCrLf &""
		 .Send
	End With
		if Err.number > 0 then
			mailMerchant = false
		else
			mailMerchant = true
		end if
		mailMerchant = false
%>

Open in new window

0
 

Author Comment

by:dcass
ID: 37779226
Email is going out now - I do believe enabling 32 bit on IIS Application pool was the key.  I do not know how I got some to go out last week without this.  I really hope this is the end of this - it's two days wasted so far and I don't even have PHP or Wordpress installed - I already hate Windows 2008, but I'm stuck with it for now.

I didn't have to make any code changes at all.

I've also closed the ports, so now there is no more hacking in.
0
 

Author Closing Comment

by:dcass
ID: 37779230
Finally someone who knew the answer!
0
 
LVL 28

Expert Comment

by:sammySeltzer
ID: 37779673
Glad you sorted things out.

Remember that php works with iis as well as apache.

So, if you decided to go that now, let us know.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Hello Friends, My friends and relatives always ask me how to delete all the various types of emails at once in our g-mail  or windows live account.  So I researched this topic to find a unique solution to this query.  Here it is for those who do …
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

705 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

15 Experts available now in Live!

Get 1:1 Help Now