Hi all,
first of all thanks for this great module, it really makes things easier.
I've created several job types on my site. Recruiters can select categories when posting a job, jobseekers can select categories they're interested in at the registration section. My question is, would it be possible to setup a jobs by email function? That means when a job post matches the category a jobseeker selected an automated email get sent to them. For example I'm interested in "Driving jobs" so I select it when registering and a recruiter posts a job into that category -> I receive an email notification.
Any help appreciated!
Thanks
Comments
Comment #1
richygecko CreditAttribution: richygecko commentedI was trying to do the same thing by using notifications module and subscriptions module and it didn't go all that well I forget the exact problems but it didn't exactly do what i was looking for. What I did in the end was enable the RSS link in the view for the JOB searches. That way a job seeker could save their search and receive the RSS items in their RSS reader.
Comment #2
xamount CreditAttribution: xamount commentedI have done this successfuly by creating a custom module for my site that uses hook_nodeapi and hooks into the op = insert
Basically this is what the module does: when a job is created (op = insert), a function is called that scans all the resume nodes and finds jobseekers that match the "category" of the job. In my case, this "category" was field of work which was a normal cck field.
All the matching jobseekers and then notified by sending them an email which contains a link to the job and other userful links in the email.
NB for large sites (like mine) where there are possibly thousands of matching jobseekers than can be found, this would mean that when a job is created 1000 emails will have to be sent when a recruiter clicks on "submit" when creating a job node. As a result, from the time you click submit until you see the confirmation page that tells you the job has been created can be a couple of seconds or minutes. This is because drupal is trying to send >1000 emails to all the matching jobseekers.
It gets worse when you have multiple jobs being created at the same time. basically, your server will choke at some point.
So what I ended up doing was queueing the jobseekers in a database table and using hook_cron to send x amount of emails per cron. This way the sending of emails are throttled and eases up on the cpu resources. Jobseekers would not be notified IMMEDIATELY, but they will eventually, and this would depend on how many times you run cron and how big your "x amount" value is.
I would have posted the code here, but it will not make much sense as the code is customized to my site and my use of cck field names etc.
Comment #3
kbahey CreditAttribution: kbahey commentedThis is a very good solution.
You can post sample pseudo-code instead. It will help a lot of people. Better yet, include it in the README.txt under a section called: Advanced Usage or something.
Regarding this issue:
There is a solution to this, I wrote the http://drupal.org/project/queue_mail module which interfaces with the job_queue module. What it does is that it makes all emails go thru cron, so the user will not see a delay when they click submit.
This works for any module that sends mails and solves the issue you describe without having to resort to custom code for each module.
Comment #4
xamount CreditAttribution: xamount commenteddamn...your queue_mail module came out a few months late!
Well here is the pseudo code. I tried to make it generic so any user can re-use it for more advanced email throttling. This is for advanced users only so only do this if you know what you are doing.
In your custom module (not the job search module):
Next you set up hook_cron to do the throttling:
The function _batch_email is a helper function that sends out batch emails. You have the $jobs and $resumes as arguments, so you can format the email to your liking. Remember to delete the jobseeker from the table after you sent them an email.
I know this code looks a bit messy, but it was hard trying to make it generic as the original code was tightly integrated with my site and other functions etc. But hopefully, it will give you an idea of how to do the throttling.
@kbahey: can you take a look at this code and make it more pseudo-ish/generic so I can include it somehow in README.txt under advanced usage?
Comment #5
kbahey CreditAttribution: kbahey commentedI meant the pseudo code for the searching/matching, since the queue_mail module solves the other problem.