Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 518
  • Last Modified:

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>


0
drujames
Asked:
drujames
  • 7
  • 5
1 Solution
 
danielsonchrisCommented:
Instead of using
Set mail = Server.CreateObject("CDONTS.NewMail")

Try the following:
Set Mail = Server.CreateObject("CDONTS.MailSender")
0
 
danielsonchrisCommented:
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
0
 
drujamesAuthor Commented:
Danielsonchris: Tried that and still got the same error.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
danielsonchrisCommented:
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.
0
 
danielsonchrisCommented:
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
0
 
drujamesAuthor Commented:
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
0
 
danielsonchrisCommented:
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
%>
0
 
drujamesAuthor Commented:
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
0
 
danielsonchrisCommented:
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
0
 
drujamesAuthor Commented:
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)
%>
0
 
danielsonchrisCommented:
Ahh have a look here:
You setup the Body variable and never added it into the .TextBody.

'snip

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" & vbCrLf & Body
         .Send()
        end with


'Now the form will have your variables in it.  
'also something to note in coding practicies is::
'You coded:
If (validationOK=false) Then Response.Redirect("error.htm?" & EmailFrom)
'should be  (It's already a boolean value)
If (Not validationOK) Then Response.Redirect("error.htm?" & EmailFrom)



in other news... here is another example for you to fiddle with if you are going to use a different SMTP server.

Set oMail = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "Localhost"
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
iConf.Fields.Update
Set oMail.Configuration = iConf
oMail.To                   = strTo
oMail.From                   = strFrom
oMail.CC                  = strCC
oMail.Subject             = strSubject
oMail.TextBody             = strBody
oMail.Send
Set iConf = Nothing
Set Flds = Nothing
0
 
drujamesAuthor Commented:
Thank you so very much that worked
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now