943,503 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 9335
  • ASP RSS
May 31st, 2004
0

Error message when running ASP email script

Expand Post »
When I run the following ASP email script I get error. I am sending the script and error messege both. Please help me as soon as possible as I am a fresher at ASP scripting.

The script:-

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<%
Option Explicit

Dim objNewMail

' First create an instance of NewMail Object
Set objNewMail = Server.CreateObject("CDONTS.NewMail")

' After an instance of NewMail Object has been created.
' If you like you can use this one line of code to send the mail.
' objNewMail.Send From, To, Subject, Message
' or you can give every value seperate

objNewMail.From = "webmaster@devasp.com"
objNewMail.To = "test@devasp.com"

' Please replace the "From" and "To" email addresses with your
' own valid email address. I recieve too many emails
' from people who test this sample and keep sending
' emails to test@devasp.com, or they keep the "From" property
' as webmaster@devasp.com and I get response of
' undeliverable emails.
' NOTE: If the "To" or "From" properties of CDONTS contain
' invalid email address you will not recieve the email.

objNewMail.Subject = "This is a test Mail"
objNewMail.Body = "This is the Body text of this test mail."
objNewMail.Send

' After the Send method, NewMail Object become Invalid
' You should set it to nothing to relase the memory

Set objNewMail = Nothing

' If you want to send another mail
' you have to create a new instance of NewMail Object again.

Response.Write "Email has been sent"

%>
</body>

</html>


The error message:-

Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/calendar/email2.asp, line 11
Option Explicit
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jigar_eng is offline Offline
1 posts
since May 2004
Jul 13th, 2004
0

Re: Error message when running ASP email script

Option Explicit must be the first thing declared in the asp file. That goes above everything else including the html.
Reputation Points: 25
Solved Threads: 7
Junior Poster
Drew is offline Offline
166 posts
since Apr 2004
Jul 13th, 2004
0

Re: Error message when running ASP email script

LMAO..... how many of us fell into this trap at the beginning? We were prolly just as confused as this guy!
Reputation Points: 10
Solved Threads: 1
Light Poster
RobUK is offline Offline
32 posts
since Jul 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: string not working
Next Thread in ASP Forum Timeline: ASP how to make the page not remembered in address bar?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC