Best option to send email notification in advance for account expiration - php

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

Related

Set notification time and notify user after that time in laravel

this is my first question. Currently i am working on a library management system where a user can issue a book for a certain time. when the time is over the system will notify the user and the admin. The notification will be showed in the notification bar. I have a hard time figuring out how to do that in laravel. I am trying to do the notification part using laravel pusher.
You can use delay() and set a time to notify.
$when = now()->addMinutes(10);
$user->notify((new InvoicePaid($invoice))->delay($when));

Notify user when next time user login in Laravel 5.4 Application

I am looking for a solution to notify all the users for occurrence of X activity in the app.
I am not looking for notification by mail or sms. Because this specific notification would be send to all the users, which could be anywhere between 1000 to 25000 users. sending 1000s of mail or sms is waste of resources.
I want to notify users using something which goes noticed, that is they would read. for example: if the X activity has happened today. And Y user logins after 10 days he/she must be able to see the notification (I guess flash message wont work in this case).
What is the best and most efficient way possible? if notification using database is the way that I think. How can I create a single notification (single entry in database) and make sure all the users read that notification next time login? without creating 1000s of rows?
I think storing notifications in the database would be the way to go too.
If you add a many-to-many relationship between your User and Notification models, with a is_read flag on the relationship pivot table.
Then when a user reads the notification, you update the is_read flag to 1. Alternatively, if you don't need to keep the notification for that user, you could delete the relationship, thus reducing storage of obsolete records.
Edit
If every user will always see every notification, then you could store the last_login_at timestamp on your User model, which is updated each time a user logs in.
Then each time a user logs in, find all Notifications created since the last_login_at and show them to the user.

how to make date reminder in PHP & MYSQL

I'm making a database for labors resident Visa, I want to make a reminder on expiry date, if a visa expire at 1/1/2012, I Want PHP to send me reminder as email, or pop up message
EDIT
thank you guys, but let's forget about the reminder via email, let's say I created a table (ID,name,issue date,expiry date) (1,joe,11/11/2009,12/11/2011) and all data are displayed in a table.. what I want to do is, I want the color of the table row to turn red in case its expired.
I hope I explained it right..
create a page to check the expiry date and do necessary action. set a cron job to call the page every one hour or a time suitable for you.
Search for cron job and how to setup it in your control panel using your search engine
Run a cron job every day to fetch the list of visas expiring on specific date, and send a mail to all the results.
More info about cron
http://www.sitepoint.com/introducing-cron/
Check this url which could be the basis of your script, and easily merged. http://www.devarticles.com/c/a/MySQL/Setup-Your-Personal-Reminder-System-Using-PHP/1/
You need to write the cronjob .. that make an email to you after a specific time
You can read more about cronjob from here ...
cronjob
Sandeep and Joby provided your solution. I would like to add this as another suggestion.
Use cron job to schedule a process that will check for visas expiring everyday. Then send an email appropriately.
To send an email easily, you can use PHPMailer library. It has a lot of built-in facility which are ready for use.

Daily digest emails on user registration

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()

Trying to make an SMS Reminder Application

I am working on a web-application to make an SMS Reminder service, which takes various inputs from the user, like the user's name, his number, and the time he wants the reminder. The reminder is then sent through an SMS. I have the SMS Gateway part figured out for which I am using Zeep Mobile's API. I wanted to know how I can send an SMS on the time input by the user.
The database would have the user-id and the time, and I need to get my application to send an sms at the time. Any tutorials on similar lines would be great help.
Thanks in advance
Let's say your reminder interval is 1 minute and you are deploying on Linux.
1) Set up a cron-job to check your database every minute for possible reminders
2) If there are reminders to be sent, execute your sending script.
3) Mark sent reminders with a status (or similar) so you don't send them again.
Depending on what server your application is deployed, you would need to run some kind of service that would run continuously and send SMS whenever one is due.
One note though, since repeated database access is costly, you may like to load up Reminders that would need to be sent in a short time. The database should be accesses periodically with a reasonable time interval.

Categories