CDO.Message 500 - Internal server error. Server 2008 & IIS 7

Hello and thank you for taking the time to look at my problem.

First, here is my code:

Dim objMail,iConf,Flds,strFrom,strSub

strFrom = Request.QueryString("ema")
strSub = Request.QueryString("sub")

If Len(strFrom) < 1 Then strFrom = ""
If Len(strSub) < 1 Then strSub = "Contact Us Request from"

Set objMail = Server.CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
Flds("") = 1
Flds("") = "c:\inetpub\mailroot\pickup"

Set objMail.Configuration = iConf
      objMail.To = ""
      objMail.Subject = strSub
      objMail.From = strFrom
      objMail.HTMLBody = "TEST"
Set objMail = Nothing

If I comment out objMail.Send and Set objMail = Nothing, I do not get the error.  I do have STMP relay installed in IIS 7 and have followed the steps at

I am able to send mail fine with Exchange on the same server.

Please advise.

Have a great day,

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Emmanuel AdebayoGlobal Windows Infrastructure Engineer - ConsultantCommented:
Did you test the SMTP to ensure that it is relaying?

GEMCCAuthor Commented:
Yes I did, at least on the Exchange side of it.
Emmanuel AdebayoGlobal Windows Infrastructure Engineer - ConsultantCommented:
No you will need to test your SMTP because that is what your CDO is using
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

GEMCCAuthor Commented:
I did a telnet successfully.  If there is something g else I need to do, please tell me instead of just saying "No you will need to test your SMTP because that is what your CDO is using ".

Thank you
Emmanuel AdebayoGlobal Windows Infrastructure Engineer - ConsultantCommented:
If you have tested your Exchange for mail relay that's fine.

I cannot see anything wrong with the code, can you please paste here the error you are getting including those logs in Event viewer and smtpvc logs.

I'm on  my way to office but will log on to see if there is any info from you.

GEMCCAuthor Commented:
The only error I am getting is:

500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.

If I comment out

Set objMail = Nothing

Then I do not get the error, but of course the message does not get sent.

Please advise.

Thank you.
GEMCCAuthor Commented:
Problem resolved:

ASP Code needed to be . . .

CreateObject("CDO.Configuration").Fields("") = ""
CreateObject("CDO.Configuration").Fields("") = 2
CreateObject("CDO.Configuration").Fields("") = "c:\inetpub\mailroot\pickup"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GEMCCAuthor Commented:
Resolved the issue
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.