Solved

ASP Mailer getting HTTP 500.100 Error

Posted on 2004-10-05
12
479 Views
Last Modified: 2008-01-09
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
Comment
Question by:drujames
  • 7
  • 5
12 Comments
 
LVL 5

Expert Comment

by:danielsonchris
ID: 12230730
Instead of using
Set mail = Server.CreateObject("CDONTS.NewMail")

Try the following:
Set Mail = Server.CreateObject("CDONTS.MailSender")
0
 
LVL 5

Expert Comment

by:danielsonchris
ID: 12230792
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
 

Author Comment

by:drujames
ID: 12230793
Danielsonchris: Tried that and still got the same error.
0
 
LVL 5

Expert Comment

by:danielsonchris
ID: 12230870
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
 
LVL 5

Expert Comment

by:danielsonchris
ID: 12230882
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
 

Author Comment

by:drujames
ID: 12230939
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 5

Expert Comment

by:danielsonchris
ID: 12231031
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
 

Author Comment

by:drujames
ID: 12231132
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
 
LVL 5

Expert Comment

by:danielsonchris
ID: 12231175
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
 

Author Comment

by:drujames
ID: 12231327
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
 
LVL 5

Accepted Solution

by:
danielsonchris earned 500 total points
ID: 12231435
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
 

Author Comment

by:drujames
ID: 12231450
Thank you so very much that worked
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Help with my python script 6 145
copyEvens challenge 6 63
stringclean challenge 26 55
tidtcpserver connection lost handle 2 42
Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now