Link to home
Start Free TrialLog in
Avatar of garethtnash
garethtnashFlag for United Kingdom of Great Britain and Northern Ireland

asked on

CDOSYS send email to multiple recipients if recordset not null

Hello Experts, Would appreciate a little help with a CDOSYS query, I have a page that runs a Stored Procedure, generates a number of recordsets, sends a confirmation email (using CDOSYS) should send an email of the SP insert to all recipents and finally does an additional insert, i was using an Dreamweaver Extension to send the second email, but as the data sent for the insert is not sent through a browser I can no longer do this, as the extension requires HTTP _USER_AGENT.

So what I want to do is replace the section begining -
<%
' Smart Mailer 1.0.8
' Send on load

With a new (second)
<%
Dim ObjSendMail

However this email is only generated and sent if recordset jbeusers is not null, additionally it should be sent to every record in jbeusers, and you will see that it is a HTML email....

I hope I have explained myself well enough, and hope you can offer a little guidance.

Many thanks
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/recruta2.asp" -->
<!--#include file="../ScriptLibrary/incSmartMailer.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") = 1
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"
Flds.Update
EmployeeName=(Session("EMPLOYEENAME"))
Vacancy=(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 " & Vacancy & " 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 " & Vacancy & " has successfully been posted on " & URLShort & "" & vbCRLF & "" & vbCRLF & "Kind regards"
ObjSendMail.Send
     
Set ObjSendMail = Nothing
%>
<%
' Smart Mailer 1.0.8
' Send on load
Server.ScriptTimeout = 300
Set sm1 = new SmartMailer
sm1.checkVersion "1.08"
sm1.contentCharset = "iso-8859-1"
Session.CodePage = sm1.getCodepage()
sm1.smtpSetup "", "", "", ""
sm1.pickup = ""
sm1.component = "cdo"
sm1.tmpFolder = ""
sm1.embedImages = true
sm1.progressBar = ""
sm1.ignore_errors = true
sm1.useQueue = false
sm1.setFrom Recordset1.Fields.Item("JBSURLShort").Value, Recordset1.Fields.Item("JBSNoReplyEmail").Value
Set sm1.toRecord = jbeusers
sm1.toRecordName = "JBENname"
sm1.toRecordEmail = "JBENusername"
sm1.total_mail = sm1.getTotalRecords(jbeusers)
while not sm1.toRecord.EOF
  sm1.setTo sm1.toRecord.Fields.Item(sm1.toRecordName).Value, sm1.toRecord.Fields.Item(sm1.toRecordEmail).Value
  sm1.Subject = "" & (VACANCY.Fields.Item("JBATitle").Value) & " advertised on " & (Recordset1.Fields.Item("JBSURLShort").Value) & ""
  ' using template for body
  sm1.setBody_Template_html "../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & ""
  ' Attachments none
  sm1.sendMail "multiple"
  jbeusers.MoveNext()
Wend
sm1.done()
%>
<%
' 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>
<%=(VACANCY.Fields.Item("JBATitle").Value)%>
</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
%>

Open in new window

Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

you would do this
<%if not jbeusers.eof then%>
Put your code to send using CDOSYS here
<%end if%>
If you are going to be doing an Insert, that needs to read if NULL is in the recordset as well.
Then add it right before the <%end if%> happens.

Hope that gets your started, if not let me know
And if I have the time I will try to assist further.

Back to getting this site done.
Carrzkiss
Avatar of garethtnash

ASKER

Two questions my friend, (but first hope you had a good July 4th weekend?)
As I'm already using Dim ObjSendMail will the second need to be like Dim ObjSendMail2?
Also as I am BCC ing multiple people, is there anything else I need to add to the BCC field? All People are from a recordset
 
Hope you are well my friend and not too stressed?
 
1.Yes.

2. I think you have AddReciepient equivallent to the BCC as well. If not, you can probably pass multiple e-mail addresses seperated by ;
It should be something like this.
(This is completely untested, so play around with it, and see if your can make it work
Into your actual Project)
Since I am not sure how your doing things, I cannot put it all together the way it should be.
Just look at the code.

This code will replace the
>>>    ' Smart Mailer 1.0.8

And if you need to do the INSERT after you send the mail, then add it at the end
I have added a not with the name of the INSERT right above the <%end if%>

----------
4th of July weekend was alright.
Spent it on the computer the entire weekend.
Did take out some time to cookout with my Son and Mother
Had to many things on my mind and could not stop working.
The site will be released later on this afternoon.
And the promotion starts on it "TODAY" so I have no other choice but to release it today.
(So, trying not to get stressed, trying that is)

Enjoy Gareth.
And like always, if you need assist, let me know.

Carrzkiss
<%if not jbeusers.eof then' This is where we start to look at the recordset, if it is not EMPTY, then we will send mail and insert some records%>
<%
Dim SMail
Dim MyConf
Dim MyFlds
Set SMail = Server.CreateObject("CDO.Message")
Set MyConf = CreateObject("CDO.Configuration")
Set MyFlds = MyConf.Fields
MyFlds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
MyFlds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"
MyFlds.Update
EmployeeName=(Session("EMPLOYEENAME"))
Vacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
ConkerEmail=(VACANCY("JBAConkersEmail"))
RecEmail=(username("JBEUsername"))
Set SMail.Configuration = MyConf
SMail.To = RECEmail
SMail.Subject = "Job Advert " & Vacancy & " posted on  " & URLShort
SMail.From = ReplyMail
if VACANCY("JBAConkersEmail")="" then
SMail.Bcc = ConkerEmail
else
end if
SMail.ReplyTo = APEmail     
SMail.TextBody = "Dear " & EmployeeName & "," & vbCRLF & "" & vbCRLF & "Your vacancy titled " & Vacancy & " has successfully been posted on " & URLShort & "" & vbCRLF & "" & vbCRLF & "Kind regards"
SMail.Send
     
Set SMail = Nothing
%>
<%'if you need to add in the INSERT to this, then you would put it here
' WA Application Builder Insert%>
<%end if%>

Open in new window

_Stilgar_:
You are correct, I forgot about that question.

Gareth
In your BCC area, you will want to use this code (Change it to suit your needs)

While Not objRs.EOF
response.Write ""&objRs("email_1")&";"
objRs.MoveNext
wend


This will add in all you names with a   ;
Between them.

Good Luck
Carrzkiss
Hi Guys,
Thanks for your help, i hope I have got this right, i've amended it a little as we are sending a HTML (webpage) email to the 'jobs by email' subscribers -
Please can you let me know whether this looks correct or not?
Many thanks
GTN

<%if not jbeusers.eof then' This is where we start to look at the recordset, if it is not EMPTY, then we will send mail and insert some records%>
<%
Dim SMail
Dim MyConf
Dim MyFlds
Set SMail = Server.CreateObject("CDO.Message")
Set MyConf = CreateObject("CDO.Configuration")
Set MyFlds = MyConf.Fields
MyFlds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
MyFlds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"
MyFlds.Update
Vacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
Set SMail.Configuration = MyConf
SMail.To = ReplyMail
SMail.Subject = "Job Advert " & Vacancy & " advertised on  " & URLShort
SMail.From = ReplyMail
SMail.Bcc = While Not jbeusers.EOF
response.Write ""& jbeusers ("JBENusername")&";"
jbeusers.MoveNext
wend 
SMail.ReplyTo = ReplyMail
SMail.CreateMHTMLBody = "../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & ""
SMail.Send
     
Set SMail = Nothing
%>
<%'if you need to add in the INSERT to this, then you would put it here
' WA Application Builder Insert%>
<%end if%>

Open in new window

OK.
I cannot for the life of me get the other code to work in this environment.
So.
The next best thing (Unless someone can get it to work the other way)
Is going to be

Loop through the recordset and send out indivisual emails to everyone within the
Criteria of the RecordSet.

I use this in my site that I am "Trying to finish and release, hopefully today???"
And it works like a complete charm.

So.
Give this as shot and see if you like it?

Carrzkiss
<%
if not jbeusers.eof then
do while not jbeusers.eof
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="webmaster@domain.com"
'myMail.Bcc= ""& jbeusers("JBENusername")&"; "
' If you decide to do it this way, It is going to be best to put the email in the TO instead of the BCC.
myMail.To= ""& jbeusers("JBENusername")&"; "
' The    do while not   and the    loop
' this is going to loop through and send the email to everyone that is on the list.
' If yo
myMail.TextBody="This is a message."
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
 
' Make sure that when sending mail to other domains, that you are using the same SMTP Domain.com and User@domain.com
' They have to be the same, if not, they will end up in the Spam Folder of such sites as: Yahoo!<br>
' My personal nightmare.
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.domain.com"
'Server port
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
%>

Open in new window

Thanks mate, hope all went well for you yesterday?
Just to confirm, should my new code look like this -
-

<%
if not jbeusers.eof then
do while not jbeusers.eof
Set myMail=CreateObject("CDO.Message")
MyFlds.Update
Vacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
myMail.Subject= "Job Advert " & Vacancy & " advertised on  " & URLShort
myMail.From= ReplyMail
myMail.To= ""& jbeusers("JBENusername")&"; "
myMail. CreateMHTMLBody = "../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & ""
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
%>

Open in new window

before I say yes.
Let make sure of a few things first.

#1 >> myMail.Subject= "Job Advert " & Vacancy & " advertised on  " & URLShort
Is the same information sent to everyone for: Vacancy and URLShort ?

#2 >>myMail.From= ReplyMail
Is the same email here: ReplyMail


If you answered [Yes - Everything is the same] then you are ready, and the code is good

If you answered [No - Different] to any of the questions above. Then no you are not ready
And you will need to let me know which once are [Different]

Carrzkiss
Thanks Mate,
 
small problem have tried running this but I get a -
 
"Microsoft VBScript runtime error '800a000d'
Type mismatch
/conkers/vacancypost3.asp, line 296 " 
Error, where line 296 is -
ConkerEmail=(VACANCY("JBAConkersEmail"))

Any ideas?

<%@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") = 1
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"
Flds.Update
EmployeeName=(Session("EMPLOYEENAME"))
Vacancy=(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 " & Vacancy & " 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 " & Vacancy & " 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")
MyFlds.Update
Vacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
myMail.Subject= "Job Advert " & Vacancy & " advertised on  " & URLShort
myMail.From= ReplyMail
myMail.To= ""& jbeusers("JBENusername")&"; "
myMail. CreateMHTMLBody = "../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & ""
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>
<%=(VACANCY.Fields.Item("JBATitle").Value)%>
</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
%>

Open in new window

I am not really sure what you have going on here, but I think that I see a problem.

Vacancy=(VACANCY("JBATitle"))  ' Problem here (Line 293)
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
ConkerEmail=(VACANCY("JBAConkersEmail"))  ' Causing this to be a Problem

You cannot have a string to be the same name as a RecordSet.
So, Change to

strVacancy=(VACANCY("JBATitle"))  ' (Line 293) change Vacancy -to- strVacancy
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
ConkerEmail=(VACANCY("JBAConkersEmail"))  ' This should run now....?

See if that will help

Thanks mate that worked, however now I get the following error -

Microsoft VBScript runtime error '800a01a8'
Object required: 'MyFlds'
/conkers/vacancypost3.asp, line 316 "
Where line 316 is -
 
MyFlds.Update

 
Again any ideas?
Thanks - :-)

<%@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") = 1
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")
MyFlds.Update
Vacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
myMail.Subject= "Job Advert " & Vacancy & " advertised on  " & URLShort
myMail.From= ReplyMail
myMail.To= ""& jbeusers("JBENusername")&"; "
myMail. CreateMHTMLBody = "../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & ""
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>
<%=(VACANCY.Fields.Item("JBATitle").Value)%>
</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
%>

Open in new window

where is   >> MyFlds.Update
Being used at?
It is not used in the script that you have provided here.
If it is not being used, then [Remove] it.
If it is being used, then show me the script and how it works in with what you have posted.
that goes with this code
http:#a24794966
But where is this code @ within the code that you have just provided?
Thanks wayne, have removed that, but now have -
   
Microsoft VBScript runtime error '800a01a8'
Object required: 'Basic Test'
/conkers/vacancypost3.asp, line 322
Where line 322 is -
myMail. CreateMHTMLBody = "../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & ""
 
Sorry for being a pain mate
 
I like that error.
Made me look really hard :~)

Need to remove the space between your . and Create

Change this
myMail. CreateMHTMLBody
to this
myMail.CreateMHTMLBody
(That was a keeper for my KB) :~)
Removed but still getting -

Microsoft VBScript runtime error '800a01a8'
Object required: 'Basic Test'
/conkers/vacancypost3.asp, line 322 "
Line 322 now reads -
myMail.CreateMHTMLBody= "../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & ""
 
 
Help!!!!
You relaxing this weekend? Project all done? Would love to see it :-)

<%@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") = 1
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")
Vacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
myMail.Subject= "Job Advert " & Vacancy & " advertised on  " & URLShort
myMail.From= ReplyMail
myMail.To= ""& jbeusers("JBENusername")&"; "
myMail.CreateMHTMLBody= "../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & ""
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>
<%=(VACANCY.Fields.Item("JBATitle").Value)%>
</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
%>

Open in new window

>>Project done....
I wish, I posponed the release as I found some bugs (Actually my son foung a HUGE bug.
Inserting Email address without proper validation would allow a person to enter a address as:
something.com   <-- as you can tell, there is no @ )
Along with a few other issues, so I am going to spend this afternoon and the entire weekend
Getting it working properly, and then I will release it hopefully on Monday. Hopefuly.(Finger crossed)
----------------
Replace your code
myMail.CreateMHTMLBody= "../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & ""

With this code
myMail. CreateMHTMLBody = "../jobseeker/afterregistration/vacancynotification.asp?ID=" &VACANCY("JBAID")
Sorry buddy still getting the same problem,... can't however wait to see your project!
If I can be of any help please let me know
GTN
try with just this
myMail. CreateMHTMLBody = "../jobseeker/afterregistration/vacancynotification.asp?ID="
Hi Wayne,
 
Hope you are well, and had a productive weekend? Ok the problem has slightly changed now -
 
Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method: 'myMail.CreateMHTMLBody'
/conkers/vacancypost3.asp, line 322
Any ideas?
 
Thanks mate
change
myMail.CreateMHTMLBody
to
myMail.CreateHTMLBody
Sorry mate new problem -
 
Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method: 'myMail.CreateHTMLBody'
/conkers/vacancypost3.asp, line 322
:-)
I found the problem.
Remove the = (Equal sign)
myMail.CreateMHTMLBody= "../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & ""

To this
myMail.CreateMHTMLBody "../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & ""


Sorry I did not get back to you sooner, I have just been put under the gun to get this site out.
(Financial Issues)
So, that has become priority #1.

I have just done some major improvements to the site.
And am going to try to release by Early Tomorrow Morning if possible.. Fingers Crossed.

Carrzkiss
Don't apologise mate, you're being extremely helpful as usual, sorry to say this but still getting the same error message -

Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method: 'myMail.CreateHTMLBody'
/conkers/vacancypost3.asp, line 322 "
Help!!
Hopefully this will take care of the issue for you.
It seems that the CreateMHTMLBody
Is not longer supported.

Hope this does it.

Carrzkiss
' add function at the top of your ASP Script
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
 
' Replace your existing with this.
myMail.HTMLBody = GetRemoteFile("../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & "")"

Open in new window

Sorry Mate, please could you explain a little more...
The function, add it in your page somewhere.
Then replace
========
myMail.CreateMHTMLBody= "../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & ""
========
With this
========
myMail.HTMLBody = GetRemoteFile("../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & "")"
========
Hi Mate Sorry to do this to you, my code now looks like below, but I get the following error -
 error '80004005'
/conkers/vacancypost3.asp, line 317
Where line 317 is -
 objXML.Open "GET", strURL, False
Any thoughts?
Thank you

<%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"))
myMail.Subject= "Job Advert " & strVacancy & " advertised on  " & URLShort
myMail.From= ReplyMail
myMail.To= ""& jbeusers("JBENusername")&"; "
myMail.HTMLBody = GetRemoteFile("../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & "")
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
%>

Open in new window

Hi Mate,
 
Hope all is well? I've revised the code a little, so it now reads like below, one small problem though, when I test i do get an email(text), the problem is all tells me is -

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

<%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
%> 

Open in new window

Line 19
HTMLBOD=
Shouldn't that be
myMail.HTMLBody = GetRemoteFile("../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & "")"
tried that, it didn't work, sorry
As long as you have that Function somewhere at the top of the page.
Please try this code, this is the way the function is suppose to work.
If it does not work, then I will have to test it later on.
As I am still working on my site, and it has not been released yet.
I keep on getting bugs, and killing them off 1 by 1.

So, try this code here, and see what happens.

Carrzkiss
<%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"))
myMail.Subject= "Job Advert " & strVacancy & " advertised on  " & URLShort
myMail.From= ReplyMail
myMail.To= ""& jbeusers("JBENusername")&"; "
myMail.HTMLBody = GetRemoteFile("../jobseeker/afterregistration/vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & "")"
myMail.Send
set myMail=nothing
 
jbeusers.MoveNext 
Loop
Set jbeusers = nothing 
end if
%> 

Open in new window

Sorry mate that gives me the following -
error '80004005'
/conkers/vacancypost3.asp, line 317
Sorry to hear about your bugs, I know the feeling!
That means that the code is working !!!
So, that is a good error (To a point, bad for ciphering it out)

Is there anything else with that error?
==================================
error '80004005'
/conkers/vacancypost3.asp, line 317
==================================
There should be something else? I need to know the rest of it.
The [80004005] can be a multitude of things

Carrzkiss
Sorry mate there is nothing else with the error, I have registered to get an email when the test advert is posted, but nothing came through, interestingly line 317 is -
 objXML.Open "GET", strURL, False

of -
<%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%>
Have i missed something in this function?
Cheers
Hi Mate,
 
I've tried something else (Sorry), this works in that it processes the page ands redirects to the success page, but no email is sent, apparently I've missed the send function, I'm just not to sure where it goes, or how it should look?
Any thoughts?
Thanks mate, hope you are almost done :-)
 

<% 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") = 1
.Update 
End With 
Set cdoM = Nothing 
Set cdoS = Nothing 
Set cdoF = Nothing
jbeusers.MoveNext 
Loop
Set jbeusers = nothing 
end if
%>

Open in new window

you keep on changing your code on me, and it is a bit confusing.
So, I am going to give it a shot and say

line 23
.Update
and this below it
.Send

So it should look like this

.Update
.Send

And I really do not know if that is going to work, as I do not know the way you have your code done.
I do not do it that way.

Good Luck
tried that mate, no joy :-( how about if we stick to the code we had yesterday, any idea what is causing the -
error '80004005'
/conkers/vacancypost3.asp, line 317
Error?
Thanks mate
ASKER CERTIFIED SOLUTION
Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Mate,
 
Sorry for the sudden lack of contact, have been on holiday, hope the site launch went well? Do let me see the site?
Right I think I've got what you mean, and have rewritten that particular code so that it reads like below, however now I get a -

Microsoft VBScript compilation error '800a0401'
Expected end of statement
/conkers/vacancypost3.asp, line 322 myMail.HTMLBody = "<table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #035591;"> "
Error, any thoughts? Cheers mate

<%
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.HTMLBody = "<table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #035591;">
   <tr>
      <td align="center">
         
         <table width="600" border="0" cellspacing="0" cellpadding="0" style="background-color: #faf4dd;">
            <tr>
               <td align="center">
                  
                  <table width="580" border="0" cellspacing="10" cellpadding="0" style="background-color: #FFFFFF;">
                     <tr>
                        <td class="header" align="left">
                           <table width="100%" height="90" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                 <td><img src="http://www.hampshirejobsonline.co.uk/jobseeker/afterregistration/jobsbyemailhead.jpg" width="800" height="245" alt="Jobs by Email"></td>
                             </tr>
                           </table>
                        </td>
                     </tr>
                     <tr>
                        <td>
                           
                           <table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                 <td style="font-family:Arial, Helvetica, sans-serif; text-align: left; vertical-align:top; width: 500px;">
                                    <h3 style="font-family: Arial; font-size: 16px; font-weight: bold; color: #CD6100; text-transform: none; margin: 22px 0px 0px 8px; padding: 0; text-transform:capitalize;">JOBTITLE</h3>
                                  <ul style="list-style:none; font-size:.8em; color: #333333; width: 468px; border:1px solid #000066; padding: 8px; background-color:#E9F0F8; text-transform:capitalize; margin: 20px 8px;">
                                    <li><label style="width:125px; clear:left; float:left;">Job Title:</label>
                                    JOBTITLE</li>
                                      <li><label style="width:125px; clear:left; float:left;">Reference:</label>
                                      REFERENCE</li>
                                     <li><label style="width:125px; clear:left; float:left;">Location:</label>
                                     LOCATION</li>
                                      <li><label style="width:125px; clear:left; float:left;">Payrate:</label>
                                      PAYRATE</li>
                                   </ul>
                                   <p style="font-family: Arial; font-size: 13px; font-weight: normal; color: #333333; font-size: 13px; Font-weight: normal; color: #4c4c4c; margin: 10px 0 0 9px; padding: 0">DESCRIPTION</p>
                                   <p style="font-family: Arial; font-size: 13px; font-weight: normal; color: #333333;	font-size: 13px; Font-weight: normal; color: #4c4c4c; margin: 10px 0 0 20px; padding: 0">&nbsp;</p>
                                   <h3 style="font-family: Arial; font-size: 14px; font-weight: bold; color: #CD6100; text-transform: none; margin: 0px 0px 0px 9px; padding: 0;"><a style="color:#CC6600" href="SITE/jobseeker/emailvacancylogin.asp?ID=8321">Click here to apply for this job</a></h3>
                                   <p style="font-family: Arial; font-size: 14px; font-weight: bold; color: #CD6100; text-transform: none; margin: 0px 0px 0px 9px; padding: 0;">&nbsp;</p>
                                   <p style="font-family: Arial; font-size: 14px; font-weight: bold; color: #CD6100; text-transform: none; margin: 0px 0px 0px 9px; padding: 0;">&nbsp;</p>
                                           <p style="font-family: Arial; font-size: 11px; color: #999999; text-transform: none; margin: 0px 0px 0px 9px; padding: 0;">You can unsubscribe to this notification by logging in to your control panel and deleting the notification.</p>
                                   </td>
                                <td width="300" class="mainbar" align="left" valign="top"><img src="http://www.hampshirejobsonline.co.uk/jobseeker/afterregistration/latestjobsdelivered.jpg" alt="Get the latest Hampshire Jobs by Email" width="300" height="346"></td>
                             </tr>
                          </table>
                           
                       </td>
                     </tr>
                     <tr>
                        <td height="80" class="footer" align="center">
                           <table width="100%" border="0" cellspacing="0" cellpadding="0">
                             <tr>
                               <td><img src="http://www.hampshirejobsonline.co.uk/jobseeker/afterregistration/footer.jpg" alt="The best jobs in Hampshire - HampshireJobsOnline.co.uk" width="800" height="180"></td>
                             </tr>
                           </table>
                           <table width="100%" border="0" cellspacing="0" cellpadding="0">
                             <tr>
                               <td style="height:120px;"><a href="http://www.sussexjobsonline.net/index.htm" target="_blank"><img src="http://www.hampshirejobsonline.co.uk/jobseeker/afterregistration/bannerback.jpg" alt="The Latest Jobs in Sussex are advertised on SussexJobsOnline.net" width="800" height="120" border="0"></a></td>
                             </tr>
                           </table></td>
                    </tr>
                     
                  </table>
                  
               </td>
            </tr>
         </table>
         
      </td>
   </tr>
</table>
"
myMail.Send
set myMail=nothing
 
jbeusers.MoveNext 
Loop
Set jbeusers = nothing 
end if
%>

Open in new window

Hi Wayne,
 
Thanks for your help with the attached, I have now finally managed to get this working using the following code, but once again, not without your help.
Hope your Site has launched successfully.
 
GTN

<%
if not jbeusers.eof then
do while not jbeusers.eof
Set myMail=CreateObject("CDO.Message")
strVacancy=(VACANCY("JBATitle"))
URLShort=(Recordset1("JBSURLShort"))
strID=(VACANCY("JBAID"))
ReplyMail=(Recordset1("JBSNoReplyEmail"))
myMail.Subject= "Job Advert " & strVacancy & " advertised on  " & URLShort
myMail.From= ReplyMail
myMail.To= ""& jbeusers("JBENusername")&"; "
myMail.CreateMHTMLBody "http://www.site.co.uk/jobseeker/afterregistration/vacancynotification.asp?ID= "& strID &""
myMail.Send
set myMail=nothing
 
jbeusers.MoveNext 
Loop
Set jbeusers = nothing 
end if
%>

Open in new window

Excellent Guru!
glad you have it working.

Site launched, and with problems.
So I have spent the last 2 weeks redesigning some issues and fixing some security holes within the site.

I am looking at lauching the revised more securer site on Friday evening, in time for a complete weekend test, and then ready for Monday for promoting it to local business's.

Good Luck Gareth
Wayne