?
Solved

cdosys - now not working in Windows2008 after working

Posted on 2012-03-28
12
Medium Priority
?
680 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 29

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 29

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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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 29

Accepted Solution

by:
sammySeltzer earned 2000 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 29

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 29

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 29

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

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

Question has a verified solution.

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

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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 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 …
Suggested Courses

864 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