lovephp Posted June 28, 2016 Share Posted June 28, 2016 How to do this like indeed.com etc sending new job alerts to users daily? Say there are 10 new job listing on the site how do i send it to all users in daily basis without cronjob? Maybe with a function but how will the query be? Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 28, 2016 Share Posted June 28, 2016 Not sure what you are really asking. You state "without cronjob" but then ask how would the "query be". First, create the logic. This would entail determining which users should get the notification. For example, you may want to exclude users that are disabled/inactive. You may want to send a notification to users if the jobs in question "match" the users on some predetermined data (industry, job type, etc.). Once you've made that determination, create the query to select the users' names and their email addresses. From the list of email addresses, create a process to generate the emails to include the name, email address, subject and body. Then send the email. There are plenty of email classes to simplify this for you. I would start with a plain-text email then modify it to an HTML version (if that's what you want to do). You can build and test the above by just pointing to a page to trigger the functionality. However, the last part would be to automate the process. Typically, this is what CRON jobs are for. If you are with a host, they should have the tools necessary to schedule such a job. Quote Link to comment Share on other sites More sharing options...
chriscloyd Posted June 28, 2016 Share Posted June 28, 2016 I agree with Psycho, but it does not have to be a cron job, if you do not want to use one. You could do it on login. When the user logs in and if it is the first login of the day you can show all available job matches/alerts for that user. Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted June 28, 2016 Share Posted June 28, 2016 (edited) Waiting for the user to log-in doesn't really have anything to do with alerts or notifications. It also means the user will miss events if they don't regularly visit the site. I have no idea why the OP even mentioned “no cronjob”. If it's supposed to run daily, it is by definition a cronjob, be it an actual Unix cronjob or a task which is triggered daily through some other mechanism (a commercial service, lovephp's PC, ...). Edited June 28, 2016 by Jacques1 Quote Link to comment Share on other sites More sharing options...
lovephp Posted June 28, 2016 Author Share Posted June 28, 2016 Not sure what you are really asking. You state "without cronjob" but then ask how would the "query be". First, create the logic. This would entail determining which users should get the notification. For example, you may want to exclude users that are disabled/inactive. You may want to send a notification to users if the jobs in question "match" the users on some predetermined data (industry, job type, etc.). Once you've made that determination, create the query to select the users' names and their email addresses. From the list of email addresses, create a process to generate the emails to include the name, email address, subject and body. Then send the email. There are plenty of email classes to simplify this for you. I would start with a plain-text email then modify it to an HTML version (if that's what you want to do). You can build and test the above by just pointing to a page to trigger the functionality. However, the last part would be to automate the process. Typically, this is what CRON jobs are for. If you are with a host, they should have the tools necessary to schedule such a job. I get what you are saying, what i was looking for is like i got tables like jobs, resumes and what i wanted to do is in resume if user selected accounting category then any new job posting where category is accounting by 12:00 pm every day all the new jobs gets sent to users email and if category was any then all jobs be it any category all gets sent to those users. So how i would do the sql query and then also select all users from members table and email it to them. I haven't done like this before a little guidance would really be helpful. Thanks Quote Link to comment Share on other sites More sharing options...
lovephp Posted June 28, 2016 Author Share Posted June 28, 2016 Waiting for the user to log-in doesn't really have anything to do with alerts or notifications. It also means the user will miss events if they don't regularly visit the site. I have no idea why the OP even mentioned “no cronjob”. If it's supposed to run daily, it is by definition a cronjob, be it an actual Unix cronjob or a task which is triggered daily through some other mechanism (a commercial service, lovephp's PC, ...). Bro i was thinking like Function sendAlerts(){ The queries here } And i include the sendAlerts(); in config file so it will always be running won't it? Quote Link to comment Share on other sites More sharing options...
lovephp Posted June 28, 2016 Author Share Posted June 28, 2016 I agree with Psycho, but it does not have to be a cron job, if you do not want to use one. You could do it on login. When the user logs in and if it is the first login of the day you can show all available job matches/alerts for that user. I was thinking od doing it on config file by creating a function which would all the time run? Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted June 28, 2016 Share Posted June 28, 2016 Your PHP scripts don't run “all the time”, only when there's actually an HTTP request. You said you want to send the notifications at 12:00 p. m. What if there's no request at 12:00 p. m.? It could happen hours later or not at all (depending on the traffic). Are you OK with delaying the notifications for an indefinite amount of time? And why would you do that? Isn't this feature important? Quote Link to comment Share on other sites More sharing options...
lovephp Posted June 28, 2016 Author Share Posted June 28, 2016 Yes you are right i did not think of it that way. So how do i create cronjob i have no idea that was why i was hesitating on using it. And how do i do the query to send notification which was posted on today's date not old. Help w out on this please Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted June 28, 2016 Share Posted June 28, 2016 None of us is going to write the code or query for you. You know what you need to do, now it's your job to start researching and programming. If you have a specific, non-trivial question (i. e. something that cannot be answered with a 10-second Google search), we can help you with that, but don't expect us to do the work for you. And how do i do the query to send notification which was posted on today's date not old. That's something you can easily find out: The MySQL manual Google (or any other search engine) So how do i create cronjob i have no idea that was why i was hesitating on using it. That's impossible to tell without knowing your exact server environment (Unix with root access, Windows, maybe an administration GUI, ...). But it again sounds like a great question for a search engine. I'm sure somebody before you has already solved that problem. Quote Link to comment Share on other sites More sharing options...
lovephp Posted June 28, 2016 Author Share Posted June 28, 2016 Hehe no i didn't mean anyone writing it for me. Ill write the codes but you guys atleast help me where i do wrong was what i mean. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted June 28, 2016 Share Posted June 28, 2016 I'm looking forward to your first sample of your own written code.... 1 Quote Link to comment Share on other sites More sharing options...
lovephp Posted June 29, 2016 Author Share Posted June 29, 2016 I'm looking forward to your first sample of your own written code.... sure give me sometime ill get back to bug u guys Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.