Daily digest emails on user registration - php

I'm writing a simple signup page for a small-scale text message service - sort of like a mailing list, but instead of emails, I send text messages to those who sign up with me.
Since its small-scale and I don't want it to get too complicated my current idea is to add users to a mySQL database and then manually add the new users to the texting list (which is managed separate unfortunately).
I was wondering if there's a way to generate a daily email digest of new registrations, so that it would just email me all the new registrations that happened today instead of an email every time someone signs up. Is this possible? Perhaps a CRONTAB?

Sure. Store the signup date in your table. Write a script which retrieves the list of people that signed up today and set up crontab to run that script at 11:59PM each night.
SELECT * FROM registrations WHERE signup_date = CURDATE()

Related

Generating Invoices and Updating Database Table Automatically

I have a possible client with the following tasks:
Teacher
The teacher generates an invoice: at the end of each month the system generates automatically
an invoice with the hours worked by the teacher. The invoice is sent to the school in PDF
format.
and
Student
View teachers information, telephone number, can email teacher.
read/comment the lessons, approves the lessons for billing. if student does not respond lessons
automatically approves within 24 hours.
I understand workings of a web application when user is actually using it, clicking the links and triggering some events.
What I don't know how to do is those parts where something has to be done automatically.
How would you solve this, where things have to be done based on time passed?
I would also appreciate for you to tell me how would you generate .pdf in PHP.
You should implement the functionality to enable the actions described, then create a cron job, set its frequency to the desired and run your task as part of the cron job. As about generating PDF with php, read this.

Algorithm sending email notifications

I am stuck with algorithm to mail notifications for users. Website is built on PHP 5.4 and MySQL 5.5 .
I have simple one-to-one messaging system built on the site I am working on, and these messages are stored in a database. The task is to send daily email at 9:00am with notification if user has some unread messages waiting for him.
The way how I accomplished it by now is this:
I run the script with cron (every 10 minutes) to collect rows after the last ID of checked message (ID is stored in 'notifications_work_table') from 'messages_table';
according to collected data, I count how many unread messages has each user on that database and then I make personalised message for each user, and store that message in 'mailing_queue_table' and setting the time to send this message at tomorrows 9:00am (if its past 9:00am this day), or to todays 9:00am (if it's past midnight this day). On 'notifications_work_table' ID is updated to last checked message id;
in parallel I run another script with cron (also every 10 minutes) to check if there are any messages to send, if the now() time is past to time when I need to send the message from 'mailing_queue_table'. In one try I send only 100 email messages.
The problems starts there, when user is online and is reading messages already on the fly. For example, user receives a message on 8:05, script, that collects unreads count (1st point) runs on 8:10, but user then reads this message on 8:12, then stored personalised message (3rd point) has false information laying there, and then I have to run again delete query to unset it from queue.
While writing this problem, I had a thought about that I could check for that if user has been online in some sort of interval, and then check should I send him a notification, or he is so active on site, that there is no necessary to store on queue and then send the mail.
Maybe you have some good literature or tutorial to do these things properly. For example, Facebook is great example of sending notifications, but good material is hard to find. Maybe you have some ideas, that you have went through in your programming life and could share with us.
Thanks,
/Rob

Best option to send email notification in advance for account expiration

I am working on a e-commerce kind of application which allows user to login register and also create a deal for him.
Every deal of the user has a expiry date attached to it.Now I store all the values in the DB table against the created deal.
I want to send the user a notification couple of days before his deal expires if he has not
updated it.Now can I achieve it using the DB trigger in any way(write a script and return value from the DB trigger) as suggested in this thread.
I should run a cron job to check it for some time interval and send notification?
I am not sure FB or other sites do it for birthday reminders or other notification.Any details on the same would be helpful to go ahead.
Thank you

Sending out notification email to user on user-defined date in php

I am making a feature on my website that allows the user to enter a task they need to finish by a certain date. The website will then notify them by email when it gets near the date, defined by the user (1 day before due date, 2 hours before due date and so on..) I am totally new to notifications and am unsure how to ask this question but here it is in an example of what I want done...
In an example:
The user types in "Need to call boss."
The user enters in the date selector, May 31st at 11:00 AM.
And then clicks the "Notify me 1 day before"
They enter their email and click submit.
My website will then notify them by email on May 30th at 11:00 AM reminding them to call their boss...
I have looked around and have noticed somethings pointing to CRON jobs.. I looked at that and am unsure if that is the way to go...
Thanks for the time!
It depends on your server. What OS, what access you have and a bunch of other stuff.
On Linux, a cron job would work. On Windows server, Task Scheduler would do the same job. Basically, you need a mechanism to call a script that will read through your database and send emails depending on conditions being true.

How to send email after one hour of the joining in getresponse.com

HI all,
I have an account in getresponse.com
I want to send emails to the members in my mailing list after one hour of their joining.
Please tell me how can i do this
I don't really know what's that getresponse.com all about and what are your possibilities, but deducing from php tag:
Php scripts can't execute for an hour => you have to schedule this. You need some database(or at least a file or sth else) to store the information when someone joined and a cron script that's scheduled to run eg. every 5 minutes that checks your database and if the time is right sends an e-mail and then removes the entry from database.
Admin interface allows you to create a follow-up message received by subscriber no sooner than 1 day after their subscription, so you will most likely have to send it through their API call:
http://dev.getresponse.com/api-doc/#send_newsletter

Categories