Why is there an error?
Posted on 2006-03-28
Why am I getting this error?
Microsoft VBScript runtime (0x800A0046)
/intermodal/email.asp, line 56
I am using this script I found:
Dim strTo, strSubject, strBody 'Strings for recipient, subject, body
Dim objCDOMail 'The CDO object
strTo = "email@example.com"
' Both of these should be changed before you run this script.
strSubject = "Sample E-mail sent from ASP 101!"
' This is multi-lined simply for readability
strBody = "THIS IS A TEST"
' Create an instance of the NewMail object.
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
' Set the properties of the object
objCDOMail.From = "firstname.lastname@example.org"
objCDOMail.To = strTo
objCDOMail.Subject = strSubject
objCDOMail.Body = strBody
' There are lots of other properties you can use.
' You can send HTML e-mail, attachments, etc...
' You can also modify most aspects of the message
' like importance, custom headers, ...
' Check the documentation for a full list as well
' as the correct syntax.
' Some of the more useful ones I've included samples of here:
'objCDOMail.Cc = "email@example.com;firstname.lastname@example.org"
'objCDOMail.Bcc = "email@example.com;firstname.lastname@example.org"
objCDOMail.Importance = 1 '(0=Low, 1=Normal, 2=High)
'objCDOMail.AttachFile "c:\path\filename.txt", "filename.txt"
' I've had several requests for how to send HTML email.
' To do so simply set the body format to HTML and then
' compose your body using standard HTML tags.
'objCDOMail.BodyFormat = 0 ' CdoBodyFormatHTML
'Outlook gives you grief unless you also set:
'objCDOMail.MailFormat = 0 ' CdoMailFormatMime
' Send the message!
' Set the object to nothing because it immediately becomes
' invalid after calling the Send method.
Set objCDOMail = Nothing
'Response.Write "Message sent to " & strTo & "!"
Response.Write "Message was sent"
Line 56 is: