Solved

cdosys - now not working in Windows2008 after working

Posted on 2012-03-28
12
644 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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

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
 
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

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

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
There was an incident about the POP3 issue for the double read receipts and delivery receipts in Exchange 2013.  There was huge research been done and found solution for the duplicate mails. Especially when the user gets  duplicate mails.
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…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

785 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