Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDOSYS Emails

Status
Not open for further replies.

Mighty

Programmer
Feb 22, 2001
1,682
US
Folks,

I got a new Windows Server 2008 machine and am using it, among other things, as my web development server. So I copied all the code from my live server to this test server.

However, I am getting access denied errors when trying to send emails from ASP programs using CDO. Sample code is below:

Code:
set objCDO = Server.CreateObject("CDO.Message")
objCDO.To = "me@mymail.com"
objCDO.From = "me@mymail.com"
objCDO.Subject = "Email Test"
objCDO.HTMLBody = "This is a test email"
objCDO.Send
set objCDO = nothing

Access Denied message comes up for the line where it is trying to send the email. Have found some posts on other sites about making sure IUSR account has write permissions on c:\inetpub\mailroot\pickup folder and making sure that localhost has relay permissions on SMTP Virtual Server.

However, neither of these made a difference. Does anyone know what is causing this?

CDO works fine for some VBScript files that run from the same server as scheduled tasks.

Mighty
 
So you do have the SMTP server installed loaclly? Have you tried relaying off of an actual mail server?
Code:
objCDO.Configuration.Fields.Item _
 ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL]  = 2
objCDO.Configuration.Fields.Item _
 ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = _
"<email_server_name>"
objCDO.Configuration.Fields.Item _
 ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25

My guess you might also try checking your firewall settings, there are some things that are blocked by default by the windows firewall in 2008
 
You will need this added as well.

Code:
objCDO.Configuration.Fields.Update
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top