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 = "contact@test.com"
If Len(strSub) < 1 Then strSub = "Contact Us Request from test.com"

Set objMail = Server.CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
   
Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"
Flds.Update

Set objMail.Configuration = iConf
      objMail.To = "test@test.com"
      objMail.Subject = strSub
      objMail.From = strFrom
      objMail.HTMLBody = "TEST"
      objMail.Send
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 http://www.itsolutionskb.com/2008/11/installing-and-configuring-windows-server-2008-smtp-server/.

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

Please advise.

Have a great day,

Don
GEMCCAsked:
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?

Regards
0
GEMCCAuthor Commented:
Yes I did, at least on the Exchange side of it.
0
Emmanuel AdebayoGlobal Windows Infrastructure Engineer - ConsultantCommented:
No you will need to test your SMTP because that is what your CDO is using
0
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
0
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.

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

objMail.Send
Set objMail = Nothing

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

Please advise.

Thank you.
0
GEMCCAuthor Commented:
Problem resolved:

ASP Code needed to be . . .

CreateObject("CDO.Configuration").Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.168.217.10"
CreateObject("CDO.Configuration").Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
CreateObject("CDO.Configuration").Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"
CreateObject("CDO.Configuration").Fields.Update
0

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