We have an application that sends alerts to people who have asked to be told when a new job advert is posted with the job type they are interested in. There are 13 job types
The email works but sends 13 emails to all those who have registered for an alert even though they have not selected that job type. The email has the correct Job Type i.e if the job posted has a job type of Musical the email tells the seeker the new job has a job type of musical.
Clearly the query is not working. Can anybody help with checking the code.
Here is the code:
Dim tbl as p
dim pm as P
dim ps as P
tbl=table.open("advert")
session.job_type=alltrim(tbl.Type_Of_Job)
tbl.close()
dim vc_job_type as c
dim vc_recipient as c
dim result as c
vc_from = "[email protected]"
t = table.open("[PathAlias.ADB_Path]\email_config")
t.fetch_first()
vc_smtp = alltrim(t.smtp)
vn_port = t.port
vc_user = alltrim(t.user)
vc_pw = alltrim(t.pw)
t.close()
vc_job_type = session.job_type
t = table.open("[PathAlias.ADB_Path]\interest")
job_type=alltrim(t.job_type_desc)
query.description = "jobs of specific type"
query.order = ""
query.filter = "'"+Job_Type+"' = '"+vc_job_type +"' .and. selected = .t."
t.fetch_first()
while .not. t.fetch_eof()
if (email_smtp_open(ps,vc_smtp,vn_port,vc_user,vc_pw)) then
pm.to = lookupc("F",t.customer_Id,"cust_email","[PathAlias.ADB_Path]\customer","Cust_Id")
pm.from = "[email protected]"
pm.subject = "New job posting on churchjobfinder.co.uk"
pm.message = "A job in the following catagory may be of interest to you has just been posted on churchjobfinder.co.uk:"+crlf(2)+vc_job_type+crlf(2)
pm.message = pm.message +"There may be posts in other job catagories that may also be of interest so it is worth regularly checking on www.churchjobfinder.co.uk."+crlf(2)
pm.message = pm.message +"Good luck with your endevours to find the right post for you."+crlf(2)
pm.message = pm.message +"Best wishes"+crlf(2)
pm.message = pm.message +"The Church Job Finder Team"
result = email_smtp_send(pm, ps)
end if
t.fetch_next()
'end while
email_smtp_close(ps)
end while
Many Thanks
John Wilson
(Doula)
The email works but sends 13 emails to all those who have registered for an alert even though they have not selected that job type. The email has the correct Job Type i.e if the job posted has a job type of Musical the email tells the seeker the new job has a job type of musical.
Clearly the query is not working. Can anybody help with checking the code.
Here is the code:
Dim tbl as p
dim pm as P
dim ps as P
tbl=table.open("advert")
session.job_type=alltrim(tbl.Type_Of_Job)
tbl.close()
dim vc_job_type as c
dim vc_recipient as c
dim result as c
vc_from = "[email protected]"
t = table.open("[PathAlias.ADB_Path]\email_config")
t.fetch_first()
vc_smtp = alltrim(t.smtp)
vn_port = t.port
vc_user = alltrim(t.user)
vc_pw = alltrim(t.pw)
t.close()
vc_job_type = session.job_type
t = table.open("[PathAlias.ADB_Path]\interest")
job_type=alltrim(t.job_type_desc)
query.description = "jobs of specific type"
query.order = ""
query.filter = "'"+Job_Type+"' = '"+vc_job_type +"' .and. selected = .t."
t.fetch_first()
while .not. t.fetch_eof()
if (email_smtp_open(ps,vc_smtp,vn_port,vc_user,vc_pw)) then
pm.to = lookupc("F",t.customer_Id,"cust_email","[PathAlias.ADB_Path]\customer","Cust_Id")
pm.from = "[email protected]"
pm.subject = "New job posting on churchjobfinder.co.uk"
pm.message = "A job in the following catagory may be of interest to you has just been posted on churchjobfinder.co.uk:"+crlf(2)+vc_job_type+crlf(2)
pm.message = pm.message +"There may be posts in other job catagories that may also be of interest so it is worth regularly checking on www.churchjobfinder.co.uk."+crlf(2)
pm.message = pm.message +"Good luck with your endevours to find the right post for you."+crlf(2)
pm.message = pm.message +"Best wishes"+crlf(2)
pm.message = pm.message +"The Church Job Finder Team"
result = email_smtp_send(pm, ps)
end if
t.fetch_next()
'end while
email_smtp_close(ps)
end while
Many Thanks
John Wilson
(Doula)
Comment