Link to home
Start Free TrialLog in
Avatar of drujames
drujames

asked on

ASP Mailer getting HTTP 500.100 Error

I am trying to email the contents of this form using the code below. But I am getting an error which I have posted below as well. Could someone please help me figure out why I am getting this code when I hit submit.


Below is The Error Code | The ASP Code | and the HTM code that I am using.

Thank you

******** The Error ***********************

HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid class string
/REMS/contact/contact.asp, line 51

************ The Asp Code ************************

<%
' Website Contact Form Generator
' http://www.tele-pro.co.uk/scripts/contact_form/ 
' This script is free to use as long as you  
' retain the credit link  

' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim Name
Dim Address
Dim City
Dim State
Dim Zip
Dim Email
Dim Phone
Dim Comments

' get posted data into variables
EmailFrom = "dru@bstweb.com"
EmailTo = "dru@bstweb.com"
Subject = "Web Form"
Name = Trim(Request.Form("Name"))
Address = Trim(Request.Form("Address"))
City = Trim(Request.Form("City"))
State = Trim(Request.Form("State"))
Zip = Trim(Request.Form("Zip"))
Email = Trim(Request.Form("Email"))
Phone = Trim(Request.Form("Phone"))
Comments = Trim(Request.Form("Comments"))

' validation
Dim validationOK
validationOK=true
If (validationOK=false) Then Response.Redirect("error.htm?" & EmailFrom)

' prepare email body text
Dim Body
Body = Body & "Name: " & Name & VbCrLf
Body = Body & "Address: " & Address & VbCrLf
Body = Body & "City: " & City & VbCrLf
Body = Body & "State: " & State & VbCrLf
Body = Body & "Zip: " & Zip & VbCrLf
Body = Body & "Email: " & Email & VbCrLf
Body = Body & "Phone: " & Phone & VbCrLf
Body = Body & "Comments: " & Comments & VbCrLf

' send email
Dim mail
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = EmailFrom
mail.Subject = Subject
mail.Body = Body
mail.Send

' redirect to success page
Response.Redirect("ok.htm?" & EmailFrom)
%>


**************** .htm code ********************************

<!-- Website Contact Form Generator -->
<!-- http://www.tele-pro.co.uk/scripts/contact_form/ -->
<!-- This script is free to use as long as you  -->
<!-- retain the credit link  -->

<form method="POST" action="contact.asp">
Fields marked (*) are required

<p>Name:<br>
<input type="text" name="Name">
<p>Address:<br>
<input type="text" name="Address">
<p>City:<br>
<input type="text" name="City">
<p>State:<br>
<input type="text" name="State">
<p>Zip:<br>
<input type="text" name="Zip">
<p>Email:<br>
<input type="text" name="Email">
<p>Phone:<br>
<input type="text" name="Phone">
<p>Comments:<br>
<textarea name="Comments"></textarea>
<p><input type="submit" name="submit" value="Submit">
</form>
<p>

<!-- Contact Form credit link -->
Created by <a target="_blank"
href="http://www.tele-pro.co.uk/scripts/contact_form/">Contact
Form Generator</a>


Avatar of danielsonchris
danielsonchris

Instead of using
Set mail = Server.CreateObject("CDONTS.NewMail")

Try the following:
Set Mail = Server.CreateObject("CDONTS.MailSender")
BTW, if the above doesn't work then ensure that you have the SMTP service setup and installed on your computer.

A little note from MS:
Collaboration Data Objects (CDO) for Microsoft® Windows NT® Server (CDONTS) has been removed from Microsoft® Windows® Server 2003. If your Web applications use CDONTS, you can modify your code to use Collaboration Data Objects for Windows 2000 (CDOSYS), which is supported by Windows Server 2003. However, if you upgrade to Windows Server 2003, CDONTS remains on your server, because Cdonts.dll is not removed during an upgrade to Windows Server 2003. CDONTS is not installed when you perform a clean installation of Windows Server 2003, but if necessary, you can copy it to the computer running Windows Server 2003 and register it.

To copy CDONTS to a computer running Windows Server 2003
On the source server, copy Cdonts.dll from the systemroot\system32 folder to a floppy disk.
On the target server, copy Cdonts.dll from the floppy disk to the folder systemroot\system32.
To register CDONTS, on the target server, in the Run dialog box, type cmd, and then click OK.
At the command prompt, change to the systemroot\system32 directory, and then type:
regsvr32 windir\system32\cdonts.dll
If the process is successful, the following message displays:

DllRegisterServer in cdonts.dll succeeded.
Click OK.
http://www.microsoft.com/resources/documentation/WindowsServ/2003/all/deployguide/en-us/Default.asp?url=/resources/documentation/windowsserv/2003/all/deployguide/en-us/iisdg_dep_tnoc.asp
Avatar of drujames

ASKER

Danielsonchris: Tried that and still got the same error.
I think you're missing the library.  Do a quick search and try and find cdonts.dll.  If you find it ensure that it is registered by following the tips listed above.  

To register CDONTS, on the target server, in the Run dialog box, type cmd, and then click OK.
At the command prompt, change to the systemroot\system32 directory, and then type:
regsvr32 windir\system32\cdonts.dll
If the process is successful, the following message displays:

DllRegisterServer in cdonts.dll succeeded.

After that try instantiating the object as you had in your original code posting.
Dohh, is this XP?  If so try this:

Dim obCDO
     Set obCDO = Server.CreateObject("CDO.message")
        with obCDO
         .From = "info@Your.biz"
         .To = "whoever@isp.com"
         .Subject = "Download Info"
         .TextBody = "Dear Customer blah blah"
         .Send()
        end with
I just moved the files off my desktop onto my external server which is a 2003 server, now when I hit submit it says page canot be displayed.
HTTP 500 - Internal server error
Internet Explorer

looking for this page http://www.strokeplay.com/home/REMS/contact/contact.asp
Well, two ways to handle it are 1) Setup IIS 6 such that you get Debugging errors listed, 2)  Use Response.Write and Response.End effectively to locate the errors within the script.  Are trying this technique?

<%
Dim MyMail
Set MyMail = Server.CreateObject("CDO.Message")
MyMail.From = "justme@myaddress.com"
MyMail.To = "friend1@address1.com;friend2@address2.com"
MyMail.Cc = "friend3@address3.com;friend4@address4.com"
MyMail.Bcc = "friend5@address5.com;friend6@address6.com"
MyMail.Subject = "Sending Mail via CDOSYS for Windows 2000/XP"
MyMail.TextBody = "Sending email with CDOSYS Message " &_
      "objects is easy! Try it!"
MyMail.AddAttachment "c:\path\smiley.gif"
MyMail.Fields("urn:schemas:httpmail:importance").Value = 2;
MyMail.Fields.Update()
MyMail.Send()
Set MyMail = Nothing
%>
I am using this code

But I am not getting the results of my form. The form is only returing this line in the email "Dear Customer blah blah"

Dim obCDO
     Set obCDO = Server.CreateObject("CDO.message")
        with obCDO
         .From = "info@Your.biz"
         .To = "whoever@isp.com"
         .Subject = "Download Info"
         .TextBody = "Dear Customer blah blah"
         .Send()
        end with
hmm.. sounds like you are missing the Subject line.  Double check the variables value prior to sending...
Subject = Request.Form("Subject")
'--or--
Subject = "My Web Form"

''Double check that it is getting assigned properly to the property.
With ...
'...
   .Subject = Subject
'...
End With
Where do I insert this code? The code I am using is below

Thanks

<%
' Website Contact Form Generator
' http://www.tele-pro.co.uk/scripts/contact_form/ 
' This script is free to use as long as you  
' retain the credit link  

' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim Name
Dim Address
Dim City
Dim State
Dim Zip
Dim Email
Dim Phone
Dim Comments

' get posted data into variables
EmailFrom = "dru@bstweb.com"
EmailTo = "dru@bstweb.com"
Subject = "Web Form"
Name = Trim(Request.Form("Name"))
Address = Trim(Request.Form("Address"))
City = Trim(Request.Form("City"))
State = Trim(Request.Form("State"))
Zip = Trim(Request.Form("Zip"))
Email = Trim(Request.Form("Email"))
Phone = Trim(Request.Form("Phone"))
Comments = Trim(Request.Form("Comments"))

' validation
Dim validationOK
validationOK=true
If (validationOK=false) Then Response.Redirect("error.htm?" & EmailFrom)

' prepare email body text
Dim Body
Body = Body & "Name: " & Name & VbCrLf
Body = Body & "Address: " & Address & VbCrLf
Body = Body & "City: " & City & VbCrLf
Body = Body & "State: " & State & VbCrLf
Body = Body & "Zip: " & Zip & VbCrLf
Body = Body & "Email: " & Email & VbCrLf
Body = Body & "Phone: " & Phone & VbCrLf
Body = Body & "Comments: " & Comments & VbCrLf

' send email
Dim obCDO
     Set obCDO = Server.CreateObject("CDO.message")
        with obCDO
         .From = "dru@bstweb.com"
         .To = "dru@bstweb.com"
         .Subject = "Online Form"
         .TextBody = "Dear Customer blah blah"
         .Send()
        end with

' redirect to success page
Response.Redirect("ok.htm?" & EmailFrom)
%>
ASKER CERTIFIED SOLUTION
Avatar of danielsonchris
danielsonchris

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you so very much that worked