Microsoft VBScript runtime error '800a01b6' Object doesn't suppor

G

GTN170777

Hello Gurus/Experts,

I could do with a little ASP CDOSYS help please.

I have a page that accepts data from an external program, validates it and
then inserts the data into the database.

The same page then sends a confirmation email to the advertiser, and
following this identifies every subscriber with matching criteria and should
then send a HTML email notifying them of the post.

Then following this inserts a record consisting of AdvertiserID, Date,
Number of Subscribers (+More fields) in a different table.

However when i try and run the script I get the following error -

"Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'myMail.CreateHTMLBody'

/conkers/vacancypost3.asp, line 322"

Where line 322 is

myMail. CreateHTMLBody
"../jobseeker/afterregistration/vacancynotification.asp?ID=" &VACANCY("JBAID")

My entire script is below - Appreciate any help you can offer -

Many thanks GTN

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/recruta2.asp" -->
<!--#include file="../WA_DataAssist/WA_AppBuilder_VB.asp" -->
<%Session.Contents.Remove("SITEID")%>
<%Session.Contents.Remove("NEWVACANCY")%>
<%Session.Contents.Remove("NEWVACANCYCATEGORY")%>
<%Session.Contents.Remove("NEWVACANCYLOCATION")%>
<%Session.Contents.Remove("NEWVACANCYDESCRIPTION")%>
<%Session.Contents.Remove("CONKERSEMAIL")%>
<%Session.Contents.Remove("EMPLOYEENAME")%>
<%Session.Contents.Remove("EMPLOYEEUSERNAME")%>
<%Session.Contents.Remove("EMPLOYEEID")%>
<%Session.Contents.Remove("JBESENT")%>
<%Session("SITEID") = "30"%>
<%Session("NEWVACANCY") = Request.QueryString("jobtitle")%>
<%Session("NEWVACANCYCATEGORY") = Request.QueryString("Category")%>
<%Session("NEWVACANCYLOCATION") = Request.QueryString("Location")%>
<%Session("NEWVACANCYDESCRIPTION") = Request.QueryString("jobdescription")%>
<%Session("CONKERSEMAIL") = Request.QueryString("conkeremail")%>
<%
Dim username__MMColParam
username__MMColParam = "%"
If (Request.QueryString("username") <> "") Then
username__MMColParam = Request.QueryString("username")
End If
%>
<%
Dim username__MMColParam2
username__MMColParam2 = "%"
If (Request.QueryString("password") <> "") Then
username__MMColParam2 = Request.QueryString("password")
End If
%>
<%
Dim username__MMColParam3
username__MMColParam3 = "30"
If (Session("SITEID") <> "") Then
username__MMColParam3 = Session("SITEID")
End If
%>
<%
Dim username
Dim username_cmd
Dim username_numRows

Set username_cmd = Server.CreateObject ("ADODB.Command")
username_cmd.ActiveConnection = MM_recruta2_STRING
username_cmd.CommandText = "SELECT JBEUsername, JBEName, JBEID FROM
dbo.JBEmployee WHERE JBEUsername = ? AND JBEPassword = ? AND JBESiteID = ?"
username_cmd.Prepared = true
username_cmd.Parameters.Append username_cmd.CreateParameter("param1", 200,
1, 255, username__MMColParam) ' adVarChar
username_cmd.Parameters.Append username_cmd.CreateParameter("param2", 200,
1, 255, username__MMColParam2) ' adVarChar
username_cmd.Parameters.Append username_cmd.CreateParameter("param3", 5, 1,
-1, username__MMColParam3) ' adDouble

Set username = username_cmd.Execute
username_numRows = 0
%>
<%Session("EMPLOYEENAME") = username.Fields.Item("JBEName").Value%>
<%Session("EMPLOYEEUSERNAME") = username.Fields.Item("JBEUsername").Value%>
<%Session("EMPLOYEEID") = username.Fields.Item("JBEID").Value%>
<%

Dim Conkers__username
Conkers__username = "0"
if(Request.QueryString("username") <> "") then Conkers__username =
Request.QueryString("username")

Dim Conkers__password
Conkers__password = "0"
if(Request.QueryString("password") <> "") then Conkers__password =
Request.QueryString("password")

Dim Conkers__siteid
Conkers__siteid = "0"
if(Session("SITEID") <> "") then Conkers__siteid = Session("SITEID")

Dim Conkers__jobtitle
Conkers__jobtitle = "0"
if(Request.QueryString("jobtitle") <> "") then Conkers__jobtitle =
Request.QueryString("jobtitle")

Dim Conkers__jobdescription
Conkers__jobdescription = "0"
if(Request.QueryString("jobdescription") <> "") then Conkers__jobdescription
= Server.HTMLEncode(Request.QueryString("jobdescription"))

Dim Conkers__Payrate
Conkers__Payrate = "0"
if(Request.QueryString("Payrate") <> "") then Conkers__Payrate =
Server.HTMLEncode(Request.QueryString("Payrate"))

Dim Conkers__Location
Conkers__Location = "0"
if(Request.QueryString("Location") <> "") then Conkers__Location =
Request.QueryString("Location")

Dim Conkers__Category
Conkers__Category = "0"
if(Request.QueryString("Category") <> "") then Conkers__Category =
Request.QueryString("Category")

Dim Conkers__JonType
Conkers__JonType = "0"
if(Request.QueryString("JonType") <> "") then Conkers__JonType =
Request.QueryString("JonType")

Dim Conkers__reference
Conkers__reference = "0"
if(Request.QueryString("reference") <> "") then Conkers__reference =
Request.QueryString("reference")

Dim Conkers__startdate
Conkers__startdate = "0"
if(Request.QueryString("startdate") <> "") then Conkers__startdate =
Request.QueryString("startdate")

Dim Conkers__conkeremai
Conkers__conkeremai = "0"
if(Request.QueryString("conkeremail") <> "") then Conkers__conkeremai =
Request.QueryString("conkeremail")

%>
<%

set Conkers = Server.CreateObject("ADODB.Command")
Conkers.ActiveConnection = MM_recruta2_STRING
Conkers.CommandText = "dbo.conker"
Conkers.CommandType = 4
Conkers.CommandTimeout = 0
Conkers.Prepared = true
Conkers.Parameters.Append Conkers.CreateParameter("@RETURN_VALUE", 3, 4)
Conkers.Parameters.Append Conkers.CreateParameter("@username", 200,
1,225,Conkers__username)
Conkers.Parameters.Append Conkers.CreateParameter("@password", 200,
1,50,Conkers__password)
Conkers.Parameters.Append Conkers.CreateParameter("@siteid", 3,
1,5,Conkers__siteid)
Conkers.Parameters.Append Conkers.CreateParameter("@jobtitle", 200,
1,50,Conkers__jobtitle)
Conkers.Parameters.Append Conkers.CreateParameter("@jobdescription", 200,
1,4000,Conkers__jobdescription)
Conkers.Parameters.Append Conkers.CreateParameter("@Payrate", 200,
1,250,Conkers__Payrate)
Conkers.Parameters.Append Conkers.CreateParameter("@Location", 200,
1,50,Conkers__Location)
Conkers.Parameters.Append Conkers.CreateParameter("@Category", 200,
1,50,Conkers__Category)
Conkers.Parameters.Append Conkers.CreateParameter("@JonType", 200,
1,50,Conkers__JonType)
Conkers.Parameters.Append Conkers.CreateParameter("@reference", 200,
1,50,Conkers__reference)
Conkers.Parameters.Append Conkers.CreateParameter("@startdate", 200,
1,50,Conkers__startdate)
Conkers.Parameters.Append Conkers.CreateParameter("@conkeremai", 200,
1,225,Conkers__conkeremai)
Conkers.Execute()

%>
<%
Dim jbeusers__MMColParam
jbeusers__MMColParam = "0"
If (Session("SITEID") <> "") Then
jbeusers__MMColParam = Session("SITEID")
End If
%>
<%
Dim jbeusers__MMColParam2
jbeusers__MMColParam2 = "%"
If (Session("NEWVACANCYLOCATION") <> "") Then
jbeusers__MMColParam2 = Session("NEWVACANCYLOCATION")
End If
%>
<%
Dim jbeusers__MMColParam3
jbeusers__MMColParam3 = "%"
If (Session("NEWVACANCYCATEGORY") <> "") Then
jbeusers__MMColParam3 = Session("NEWVACANCYCATEGORY")
End If
%>
<%
Dim jbeusers__MMColParam4
jbeusers__MMColParam4 = "%"
If (Session("NEWVACANCYDESCRIPTION") <> "") Then
jbeusers__MMColParam4 = Session("NEWVACANCYDESCRIPTION")
End If
%>
<%
Dim jbeusers
Dim jbeusers_cmd
Dim jbeusers_numRows

Set jbeusers_cmd = Server.CreateObject ("ADODB.Command")
jbeusers_cmd.ActiveConnection = MM_recruta2_STRING
jbeusers_cmd.CommandText = "SELECT * FROM dbo.JBEmailNotification WHERE
JBENsiteID = ? AND JBENlocation = ? AND JBENcategory = ? AND ? like '%' +
JBENKeyword + '%'"
jbeusers_cmd.Prepared = true
jbeusers_cmd.Parameters.Append jbeusers_cmd.CreateParameter("param1", 5, 1,
-1, jbeusers__MMColParam) ' adDouble
jbeusers_cmd.Parameters.Append jbeusers_cmd.CreateParameter("param2", 200,
1, 255, jbeusers__MMColParam2) ' adVarChar
jbeusers_cmd.Parameters.Append jbeusers_cmd.CreateParameter("param3", 200,
1, 255, jbeusers__MMColParam3) ' adVarChar
jbeusers_cmd.Parameters.Append jbeusers_cmd.CreateParameter("param4", 200,
1, 4000, jbeusers__MMColParam4) ' adVarChar

Set jbeusers = jbeusers_cmd.Execute
jbeusers_numRows = 0
%>
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "0"
If (Session("SITEID") <> "") Then
Recordset1__MMColParam = Session("SITEID")
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_recruta2_STRING
Recordset1_cmd.CommandText = "SELECT JBSSiteID, JBSMetaTitle, JBSLogo,
JBSMetaKeywords, JBSMetaDescription, JBSHomePageText, JBSURL, JBSURLShort,
JBSNoReplyEmail FROM dbo.JBSite WHERE JBSSiteID = ?"
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 5,
1, -1, Recordset1__MMColParam) ' adDouble

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
Dim USERS__MMColParam
USERS__MMColParam = "0"
If (Session("SITEID") <> "") Then
USERS__MMColParam = Session("SITEID")
End If
%>
<%
Dim USERS__MMColParam2
USERS__MMColParam2 = "%"
If (Session("NEWVACANCYLOCATION") <> "") Then
USERS__MMColParam2 = Session("NEWVACANCYLOCATION")
End If
%>
<%
Dim USERS__MMColParam3
USERS__MMColParam3 = "%"
If (Session("NEWVACANCYCATEGORY") <> "") Then
USERS__MMColParam3 = Session("NEWVACANCYCATEGORY")
End If
%>
<%
Dim USERS__MMColParam4
USERS__MMColParam4 = "%"
If (Session("NEWVACANCYDESCRIPTION") <> "") Then
USERS__MMColParam4 = Session("NEWVACANCYDESCRIPTION")
End If
%>
<%
Dim USERS
Dim USERS_cmd
Dim USERS_numRows

Set USERS_cmd = Server.CreateObject ("ADODB.Command")
USERS_cmd.ActiveConnection = MM_recruta2_STRING
USERS_cmd.CommandText = "SELECT COUNT(JBENusername) As USERS FROM
dbo.JBEmailNotification WHERE JBENsiteID = ? AND JBENlocation = ? AND
JBENcategory = ? AND ? like '%' + JBENKeyword + '%'"
USERS_cmd.Prepared = true
USERS_cmd.Parameters.Append USERS_cmd.CreateParameter("param1", 5, 1, -1,
USERS__MMColParam) ' adDouble
USERS_cmd.Parameters.Append USERS_cmd.CreateParameter("param2", 200, 1, 255,
USERS__MMColParam2) ' adVarChar
USERS_cmd.Parameters.Append USERS_cmd.CreateParameter("param3", 200, 1, 255,
USERS__MMColParam3) ' adVarChar
USERS_cmd.Parameters.Append USERS_cmd.CreateParameter("param4", 200, 1,
4000, USERS__MMColParam4) ' adVarChar

Set USERS = USERS_cmd.Execute
USERS_numRows = 0
%>
<%
Dim VACANCY__MMColParam
VACANCY__MMColParam = "0"
If (Session("NEWVACANCY") <> "") Then
VACANCY__MMColParam = Session("NEWVACANCY")
End If
%>
<%
Dim VACANCY__MMColParam2
VACANCY__MMColParam2 = "0"
If (Session("EMPLOYEEID") <> "") Then
VACANCY__MMColParam2 = Session("EMPLOYEEID")
End If
%><%
Dim VACANCY__MMColParam3
VACANCY__MMColParam3 = "0"
If (Session("SITEID") <> "") Then
VACANCY__MMColParam3 = Session("SITEID")
End If
%><%
Dim VACANCY
Dim VACANCY_cmd
Dim VACANCY_numRows

Set VACANCY_cmd = Server.CreateObject ("ADODB.Command")
VACANCY_cmd.ActiveConnection = MM_recruta2_STRING
VACANCY_cmd.CommandText = "SELECT JBAID, JBAEmployeeID, JBASiteID, JBATitle,
JBADatePosted, JBADescription, JBAPayRate, JBALocation, JBAEmplymentType,
JBAReference, JBAConkersEmail FROM dbo.JBAdvert WHERE JBATitle = ? AND
JBAEmployeeID = ? AND JBASiteID = ? AND JBADatePosted BETWEEN DATEADD(mi, -3,
GETDATE()) AND GETDATE()"
VACANCY_cmd.Prepared = true
VACANCY_cmd.Parameters.Append VACANCY_cmd.CreateParameter("param1", 200, 1,
255, VACANCY__MMColParam) ' adVarChar
VACANCY_cmd.Parameters.Append VACANCY_cmd.CreateParameter("param2", 5, 1,
-1, VACANCY__MMColParam2) ' adDouble
VACANCY_cmd.Parameters.Append VACANCY_cmd.CreateParameter("param3", 5, 1,
-1, VACANCY__MMColParam3) ' adDouble

Set VACANCY = VACANCY_cmd.Execute
VACANCY_numRows = 0
%>
<%Session("JBESENT") = (USERS.Fields.Item("USERS").Value)%>
<%
Dim ObjSendMail
Dim iConf
Dim Flds
Set ObjSendMail = Server.CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") =
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"
Flds.Update
EmployeeName=(Session("EMPLOYEENAME"))
strVacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
ConkerEmail=(VACANCY("JBAConkersEmail"))
RecEmail=(username("JBEUsername"))
Set ObjSendMail.Configuration = iConf
ObjSendMail.To = RECEmail
ObjSendMail.Subject = "Job Advert " & strVacancy & " posted on " & URLShort
ObjSendMail.From = ReplyMail
if VACANCY("JBAConkersEmail")="" then
ObjSendMail.Bcc = ConkerEmail
else
end if
ObjSendMail.ReplyTo = APEmail
ObjSendMail.TextBody = "Dear " & EmployeeName & "," & vbCRLF & "" & vbCRLF &
"Your vacancy titled " & strVacancy & " has successfully been posted on " &
URLShort & "" & vbCRLF & "" & vbCRLF & "Kind regards"
ObjSendMail.Send

Set ObjSendMail = Nothing
%>
<%
if not jbeusers.eof then
do while not jbeusers.eof
Set myMail=CreateObject("CDO.Message")
strVacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
myMail.Subject= "Job Advert " & strVacancy & " advertised on " & URLShort
myMail.From= ReplyMail
myMail.To= ""& jbeusers("JBENusername")&"; "
myMail. CreateHTMLBody
"../jobseeker/afterregistration/vacancynotification.asp?ID=" &VACANCY("JBAID")
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.domain.com"
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing

jbeusers.MoveNext
Loop
Set jbeusers = nothing
objConn.close
end if
%>
<%
' WA Application Builder Insert
if ("" = "") then
WA_connection = MM_recruta2_STRING
WA_table = "dbo.JBESent"
WA_sessionName = "JBESent_JBESID"
WA_redirectURL = "success.asp"
WA_keepQueryString = false
WA_indexField = "JBESID"
WA_fieldNamesStr =
"JBESSiteID|JBESJobID|JBESLocation|JBESCategory|JBESReceipients"
WA_fieldValuesStr = "" & cStr( Session("SITEID") ) & "" & "|" & "" &
cStr((VACANCY.Fields.Item("JBAID").Value)) & "" & "|" & "" & cStr(
Session("NEWVACANCYLOCATION") ) & "" & "|" & "" & cStr(
Session("NEWVACANCYCATEGORY") ) & "" & "|" & "" & cStr( Session("JBESENT") )
& ""
WA_columnTypesStr =
"none,none,NULL|none,none,NULL|',none,''|',none,''|none,none,NULL"
WA_comparisonStr = " = | = | LIKE | LIKE | = "
WA_fieldNames = Split(WA_fieldNamesStr,"|")
WA_fieldValues = Split(WA_fieldValuesStr,"|")
WA_columns = Split(WA_columnTypesStr,"|")
WA_comparisions = Split(WA_comparisonStr, "|")

insertParamsObj = WA_AB_generateInsertParams(WA_fieldNames, WA_columns,
WA_fieldValues, -1)
set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = WA_connection
MM_editCmd.CommandText = "INSERT INTO " & WA_table & " (" &
insertParamsObj(1) & ") VALUES (" & insertParamsObj(2) & ")"
MM_editCmd.Execute()
MM_editCmd.ActiveConnection.Close()
obj = WA_AB_generateWhereClause(WA_fieldNames, WA_columns, WA_fieldValues,
WA_comparisions)
sqlstr = "SELECT " & WA_indexField & " FROM " & WA_table & " WHERE " &
obj & " ORDER BY " & WA_indexField & " DESC"
set WA_AppBuilderRecordset = Server.CreateObject("ADODB.Recordset")
WA_AppBuilderRecordset.ActiveConnection = WA_connection
WA_AppBuilderRecordset.Source = sqlstr
WA_AppBuilderRecordset.CursorType = 0
WA_AppBuilderRecordset.CursorLocation = 2
WA_AppBuilderRecordset.LockType = 1
WA_AppBuilderRecordset.Open()
if (NOT WA_AppBuilderRecordset.EOF) then Session(WA_sessionName) =
WA_AppBuilderRecordset.Fields.Item(WA_indexField).Value
WA_AppBuilderRecordset.Close()
if (WA_redirectURL <> "") then
if (WA_keepQueryString AND Request.QueryString <> "" AND
Request.QueryString.Count > 0) then
if (inStr(WA_redirectURL,"?") > 0) then
WA_redirectURL = WA_redirectURL & "&"
else
WA_redirectURL = WA_redirectURL & "?"
end if
WA_redirectURL = WA_redirectURL & Request.QueryString
end if
Response.Redirect(WA_redirectURL)
end if
end if
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (jbeusers_total = -1) Then

' count the total records by iterating through the recordset
jbeusers_total=0
While (Not jbeusers.EOF)
jbeusers_total = jbeusers_total + 1
jbeusers.MoveNext
Wend

' reset the cursor to the beginning
If (jbeusers.CursorType > 0) Then
jbeusers.MoveFirst
Else
jbeusers.Requery
End If

' set the number of rows displayed on this page
If (jbeusers_numRows < 0 Or jbeusers_numRows > jbeusers_total) Then
jbeusers_numRows = jbeusers_total
End If

' set the first and last displayed record
jbeusers_first = 1
jbeusers_last = jbeusers_first + jbeusers_numRows - 1

If (jbeusers_first > jbeusers_total) Then
jbeusers_first = jbeusers_total
End If
If (jbeusers_last > jbeusers_total) Then
jbeusers_last = jbeusers_total
End If

End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>vacancypost</title>
<meta name="Robots" content="noindex,nofollow" />
</head>

<body>
</body>
</html>
<%
username.Close()
Set username = Nothing
%>
<%
jbeusers.Close()
Set jbeusers = Nothing
%>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
USERS.Close()
Set USERS = Nothing
%><%
VACANCY.Close()
Set VACANCY = Nothing
%>
 
G

GTN170777

Hi Bob,

I'm really struggleing with this, I have made a few changes based on what I
have read online, as detailed below, but now rather than getting a HTML email
when I test I just get a text email which reads -

../jobseeker/afterregistration/vacancynotification.asp?ID=7513

My revised code is below, any thoughts would be appreciated please -

<%Function GetRemoteFile(strURL)
Dim objXML, strContents, arrLines
Set objXML=Server.CreateObject("Microsoft.XMLHTTP")

'read text file...
objXML.Open "GET", strURL, False
objXML.Send
GetRemoteFile = objXML.ResponseText
Set objXML=Nothing
End Function
' end function%>
<%
if not jbeusers.eof then
do while not jbeusers.eof
Set myMail=CreateObject("CDO.Message")
strVacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
HTMLBOD=("../jobseeker/afterregistration/vacancynotification.asp?ID=" &
(VACANCY.Fields.Item("JBAID").Value) & "")
myMail.Subject= "Job Advert " & strVacancy & " advertised on " & URLShort
myMail.From= ReplyMail
myMail.To= ""& jbeusers("JBENusername")&"; "
myMail.HTMLBody = HTMLBOD
myMail.Send
set myMail=nothing

jbeusers.MoveNext
Loop
Set jbeusers = nothing
end if
%>
 
B

Bob Barrows

GTN170777 said:
Hi Bob,

I'm really struggleing with this, I have made a few changes based on
what I have read online, as detailed below, but now rather than
getting a HTML email when I test I just get a text email which reads -

./jobseeker/afterregistration/vacancynotification.asp?ID=7513

My revised code is below, any thoughts would be appreciated please -

<%Function GetRemoteFile(strURL)
<%
if not jbeusers.eof then
do while not jbeusers.eof
Set myMail=CreateObject("CDO.Message")
strVacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
myMail.Subject= "Job Advert " & strVacancy & " advertised on " &
URLShort
myMail.From= ReplyMail
myMail.To= ""& jbeusers("JBENusername")&"; "
myMail.Send


You never set the email format.
A quick google for html CDO.Message would have had your answer:
http://www.lmgtfy.com/?q=html+cdo.message
The first search result contains your answer: Specifically:
' for CDO.Message:

set cdoM = CreateObject("CDO.Message")
set cdoC = CreateObject("CDO.Configuration")

Set cdoF = cdoC.Fields
With cdoF
.Item(cdoURL & "sendusing") = 2 <<<<<====
.Item(cdoURL & "smtpserver") = SMTPServer
.Item(cdoURL & "smtpconnectiontimeout") = 10
.Update
End With

With cdoM
Set .Configuration = cdoC <<<<<=====
 
G

GTN170777

I'm trying to use the mail server built into iis, not an external smtp server
though, I'm new to CDOSYS and have been Google 'ing it for days, testing
different ideas I have read up on, but am still stuck, hence the cry for help
here
 
B

Bob Barrows

I don't understand why that is an issue. Leave the smtp server setting set
to the default and use the rest of the code ...
 
G

GTN170777

Thanks, sorry its been a head in hand few days!!

Should my code look like this then -

<%Function GetRemoteFile(strURL)
Dim objXML, strContents, arrLines
Set objXML=Server.CreateObject("Microsoft.XMLHTTP")

'read text file...
objXML.Open "GET", strURL, False
objXML.Send
GetRemoteFile = objXML.ResponseText
Set objXML=Nothing
End Function
' end function%>
<%
if not jbeusers.eof then
do while not jbeusers.eof
Set myMail=CreateObject("CDO.Message")
set cdoC = CreateObject("CDO.Configuration")
Set cdoF = cdoC.Fields
With cdoF
..Item(cdoURL & "sendusing") = 2 <<<<<====
..Item(cdoURL & "smtpserver") = SMTPServer
..Item(cdoURL & "smtpconnectiontimeout") = 10
..Update
End With
With myMail
Set .Configuration = cdoC
strVacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
HTMLBOD=("../jobseeker/afterregistration/vacancynotification.asp?ID=" &
(VACANCY.Fields.Item("JBAID").Value) & "")
myMail.Subject= "Job Advert " & strVacancy & " advertised on " & URLShort
myMail.From= ReplyMail
myMail.To= ""& jbeusers("JBENusername")&"; "
myMail.HTMLBody = HTMLBOD
myMail.Send
set myMail=nothing

jbeusers.MoveNext
Loop
Set jbeusers = nothing
end if
%>

Hope I've got that right, also am I right that i don't need the -

<%Function GetRemoteFile(strURL)
Dim objXML, strContents, arrLines
Set objXML=Server.CreateObject("Microsoft.XMLHTTP")

'read text file...
objXML.Open "GET", strURL, False
objXML.Send
GetRemoteFile = objXML.ResponseText
Set objXML=Nothing
End Function
' end function%>

Function?

Thanks again Bob
 
B

Bob Barrows

GTN170777 said:
Thanks, sorry its been a head in hand few days!!

Should my code look like this then -

No. Remove the line setting the smtp server property (remember, you want the
default server to be used ...), as well as the one setting the timeout
property.
You also need to go read that article. You have left out a few key CONST
declarations. I'm not going to spoon-feed this to you. You will never learn
for yourself if I do that. Everything you need is there to be read in the
article I pointed you at.
 
G

GTN170777

Thanks Bob, I appreciate you not spoon feeding me (i do need to learn)

I've taken the below and ammended it from the first link you sent --
http://classicasp.aspfaq.com/email/how-do-i-send-e-mail-in-html-format.html

Does it look almost right? - thanks

<% if not jbeusers.eof then
do while not jbeusers.eof
strVacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
HTMLBOD=("../jobseeker/afterregistration/vacancynotification.asp?ID=" &
(VACANCY.Fields.Item("JBAID").Value) & "")



CONST cdoURL = "http://schemas.microsoft.com/cdo/configuration/"

CONST FromAddress = ReplyMail
CONST FromName = ReplyMail
CONST ToAddress = ""& jbeusers("JBENusername")&"; "

CONST Subject = "Job Advert " & strVacancy & " advertised on " & URLShort
CONST url =
"http://www.site.com/jobseeker/afterregistration/vacancynotification.asp?ID="
& (VACANCY.Fields.Item("JBAID").Value) & "")


' for CDO.Message:

set cdoM = CreateObject("CDO.Message")
set cdoC = CreateObject("CDO.Configuration")

Set cdoF = cdoC.Fields
With cdoF
.Item(cdoURL & "sendusing") = 2

.Update
End With


Set cdoM = Nothing
Set cdoS = Nothing
Set cdoF = Nothing
set CONST =nothing

jbeusers.MoveNext
Loop
Set jbeusers = nothing
end if
%>
 
B

Bob Barrows

G

GTN170777

sadly not, now i get this -

Microsoft VBScript compilation error '800a0415'

Expected literal constant

/conkers/vacancypost3.asp, line 323

CONST FromAddress = ReplyMail
-----------------------------^
 
B

Bob Barrows

GTN170777 said:
sadly not, now i get this -

Microsoft VBScript compilation error '800a0415'

Expected literal constant

/conkers/vacancypost3.asp, line 323

CONST FromAddress = ReplyMail
-----------------------------^

So either change "ReplyMail" to a quoted literal string, or declare
FromAddress as a variable and assign ReplyMail to it, like this:

Dim FromAddress
FromAddress = ReplyMail
 
G

GTN170777

Morning Bob,

Thanks for that, I've changed the code so that it looks like below - however
I'm still getting an error. You've probably guessed that I am more of a
Dreamweaver developer than a coder! my code is -

<% if not jbeusers.eof then
do while not jbeusers.eof
strVacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
HTMLBOD=("../jobseeker/afterregistration/vacancynotification.asp?ID=" &
(VACANCY.Fields.Item("JBAID").Value) & "")
CONST cdoURL = "http://schemas.microsoft.com/cdo/configuration/"
Dim FromAddress
FromAddress = ReplyMail
Dim FromName
FromName = ReplyMail
Dim ToAddress
ToAddress = ""& jbeusers("JBENusername")&"; "
Dim Subject
Subject = "Job Advert " & strVacancy & " advertised on " & URLShort
Dim url
url =
"http://www.hampshirejobsonline.co.uk/jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & "")
' for CDO.Message:
set cdoM = CreateObject("CDO.Message")
set cdoC = CreateObject("CDO.Configuration")
Set cdoF = cdoC.Fields
With cdoF
..Item(cdoURL & "sendusing") = 2
..Update
End With
Set cdoM = Nothing
Set cdoS = Nothing
Set cdoF = Nothing
jbeusers.MoveNext
Loop
Set jbeusers = nothing
end if
%>

The error code is -

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/conkers/vacancypost3.asp, line 328

url =
"http://www.hampshirejobsonline.co.uk/jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & "")"

Hope you can point out where I am going wrong.

Many thanks
 
G

GTN170777

Morning Bob, again!

I've changed the code to so that it reads like this, but I still get an
error - the code is -

<% if not jbeusers.eof then
do while not jbeusers.eof
strVacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail")
HTMLBOD=("http://www.hampshirejobsonline.co.uk/jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & "")
CONST cdoURL = "http://schemas.microsoft.com/cdo/configuration/"
Dim FromAddress
FromAddress = ReplyMail
Dim FromName
FromName = ReplyMail
Dim ToAddress
ToAddress = ""& jbeusers("JBENusername")&"; "
Dim Subject
Subject = "Job Advert " & strVacancy & " advertised on " & URLShort
Dim url
url = HTMLBOD
' for CDO.Message:
set cdoM = CreateObject("CDO.Message")
set cdoC = CreateObject("CDO.Configuration")
Set cdoF = cdoC.Fields
With cdoF
..Item(cdoURL & "sendusing") = 2
..Update
End With
Set cdoM = Nothing
Set cdoS = Nothing
Set cdoF = Nothing
jbeusers.MoveNext
Loop
Set jbeusers = nothing
end if
%>

The errors is -

Microsoft VBScript runtime error '800a0411'

Name redefined: 'cdoURL'

/conkers/vacancypost3.asp, line 318

Line 318 is -

CONST cdoURL = "http://schemas.microsoft.com/cdo/configuration/"

Thanks for your help
 
B

Bob Barrows

GTN170777 said:
Morning Bob, again!

I've changed the code to so that it reads like this, but I still get
an
error - the code is -

<% if not jbeusers.eof then
do while not jbeusers.eof
strVacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
HTMLBOD=("http://www.hampshirejobsonline.co.uk/jobseeker/afterregistration/vacancynotification.asp?ID="
& (VACANCY.Fields.Item("JBAID").Value) & "")
CONST cdoURL =
"http://schemas.microsoft.com/cdo/configuration/"
Line 318 is -

CONST cdoURL = "http://schemas.microsoft.com/cdo/configuration/"

That means you've done this twice. Search your code for "cdoURL". If you
can't find it, then maybe Dreamweaver has defined this constant for you so
you can just remove this line.
 
G

GTN170777

Newsreaders put line breaks in unexpected places. This should be a single
line, not two lines

--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
 
G

GTN170777

Thanks, I've removed the line of code, so it now looks like below, the page
processes and redirects to the success page, but the email isn't sent?

<% if not jbeusers.eof then
do while not jbeusers.eof
strVacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail")
HTMLBOD=("http://www.hampshirejobsonline.co.uk/jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & "")
Dim FromAddress
FromAddress = ReplyMail
Dim FromName
FromName = ReplyMail
Dim ToAddress
ToAddress = ""& jbeusers("JBENusername")&"; "
Dim Subject
Subject = "Job Advert " & strVacancy & " advertised on " & URLShort
Dim url
url = HTMLBOD
' for CDO.Message:
set cdoM = CreateObject("CDO.Message")
set cdoC = CreateObject("CDO.Configuration")
Set cdoF = cdoC.Fields
With cdoF
..Item(cdoURL & "sendusing") = 2
..Update
End With
Set cdoM = Nothing
Set cdoS = Nothing
Set cdoF = Nothing
jbeusers.MoveNext
Loop
Set jbeusers = nothing
end if
%>

If I try the following code instead, again everything works fine, but still
no email recieved?

I'm confused?

<% if not jbeusers.eof then
do while not jbeusers.eof
strVacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail")
HTMLBOD=("http://www.hampshirejobsonline.co.uk/jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & "")
Dim FromAddress
FromAddress = ReplyMail
Dim FromName
FromName = ReplyMail
Dim ToAddress
ToAddress = ""& jbeusers("JBENusername")&"; "
Dim Subject
Subject = "Job Advert " & strVacancy & " advertised on " & URLShort
Dim url
url =
"http://www.hampshirejobsonline.co.uk/jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & ""
' for CDO.Message:
set cdoM = CreateObject("CDO.Message")
set cdoC = CreateObject("CDO.Configuration")
Set cdoF = cdoC.Fields
With cdoF
..Item(cdoURL & "sendusing") = 2
..Update
End With
Set cdoM = Nothing
Set cdoS = Nothing
Set cdoF = Nothing
jbeusers.MoveNext
Loop
Set jbeusers = nothing
end if
%>

It should be looping through jbeusers and sending the email to each record
on the database, I've created a test record using my email address, but get
nothing from it?

Any ideas?

Thanks again, and sorry for being a pain.

GTN
 
G

GTN170777

Also, I've got a similar function running on the page, prior to this one,
which is below, that code works fine and the email is sent..

<%
Dim ObjSendMail
Dim iConf
Dim Flds
Set ObjSendMail = Server.CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") =
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"
Flds.Update
EmployeeName=(Session("EMPLOYEENAME"))
strVacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
ConkerEmail=(VACANCY("JBAConkersEmail"))
RecEmail=(username("JBEUsername"))
Set ObjSendMail.Configuration = iConf
ObjSendMail.To = RECEmail
ObjSendMail.Subject = "Job Advert " & strVacancy & " posted on " & URLShort
ObjSendMail.From = ReplyMail
if VACANCY("JBAConkersEmail")="" then
ObjSendMail.Bcc = ConkerEmail
else
end if
ObjSendMail.ReplyTo = APEmail
ObjSendMail.TextBody = "Dear " & EmployeeName & "," & vbCRLF & "" & vbCRLF &
"Your vacancy titled " & strVacancy & " has successfully been posted on " &
URLShort & "" & vbCRLF & "" & vbCRLF & "Kind regards"
ObjSendMail.Send

Set ObjSendMail = Nothing
%>

So all together the code looks like -

<%
Dim ObjSendMail
Dim iConf
Dim Flds
Set ObjSendMail = Server.CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") =
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"
Flds.Update
EmployeeName=(Session("EMPLOYEENAME"))
strVacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
ConkerEmail=(VACANCY("JBAConkersEmail"))
RecEmail=(username("JBEUsername"))
Set ObjSendMail.Configuration = iConf
ObjSendMail.To = RECEmail
ObjSendMail.Subject = "Job Advert " & strVacancy & " posted on " & URLShort
ObjSendMail.From = ReplyMail
if VACANCY("JBAConkersEmail")="" then
ObjSendMail.Bcc = ConkerEmail
else
end if
ObjSendMail.ReplyTo = APEmail
ObjSendMail.TextBody = "Dear " & EmployeeName & "," & vbCRLF & "" & vbCRLF &
"Your vacancy titled " & strVacancy & " has successfully been posted on " &
URLShort & "" & vbCRLF & "" & vbCRLF & "Kind regards"
ObjSendMail.Send

Set ObjSendMail = Nothing
%>
<% if not jbeusers.eof then
do while not jbeusers.eof
strVacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail")
HTMLBOD=("http://www.hampshirejobsonline.co.uk/jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & "")
Dim FromAddress
FromAddress = ReplyMail
Dim FromName
FromName = ReplyMail
Dim ToAddress
ToAddress = ""& jbeusers("JBENusername")&"; "
Dim Subject
Subject = "Job Advert " & strVacancy & " advertised on " & URLShort
Dim url
url =
"http://www.hampshirejobsonline.co.uk/jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & ""
' for CDO.Message:
set cdoM = CreateObject("CDO.Message")
set cdoC = CreateObject("CDO.Configuration")
Set cdoF = cdoC.Fields
With cdoF
..Item(cdoURL & "sendusing") = 2
..Update
End With
Set cdoM = Nothing
Set cdoS = Nothing
Set cdoF = Nothing
jbeusers.MoveNext
Loop
Set jbeusers = nothing
end if
%>

Hope this helps?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top