Jump to content

send alerts to users?


lovephp

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by Jacques1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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:

 

 

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.