I'm trying to figure out a good solution for sending email notifications based on user preference. Users can set up notifications to come
Everytime the event occurs
Once an hour
Once a day
Once a week
Would the best way to do this be to set up a crontab that runs a .php every minute checking to see if anything needs to be sent out? Is there another way/more efficient way to schedule something like this?
I'd say the following:
In case the email should be sent everytime the event occurs, then you don't need any crontab. Just send the email when the event occur.
Run a crontab once an hour. This crontab will fetch all events from the last hour, and send an email with all these events to the users requesting a hourly email.
Do the same once a day and once a week for users with daily and weekly emails preferences.
Related
I'm working on an ionic project.
If users don't open the application for a long time after downloading my app, I'd like to send them local notification.
For example, I will send a notification if it does not open for 3 days. But I couldn't figure out how.
Can you help me?
You can use the following to send notifications from server:
Create one table in your database to track user activities.
Add columns as userId, lastActivity to store the time of the user's activity.
Update the lastActivity column whenever the user opens the app.
Write one scheduler which will run at a specific time every day.
In the scheduler write a logic to get data from UserActivity table and compare the time stored in the table with your current time.
If the time difference is greater than 3 days then send a notification to that user.
For local notifications here is a way:
Whenever user open's the app schedule the local notification of after 3 days from current date. ( Make sure to remove previously schedule notification before adding new one. )
In this case if user open the app notification will reschedule automatically else notification will fire based on last schedule of it.
You can create a system in which you track user like ,
if user's opens your App then you must update true value for that user with time in your database and now you can compare current time with user's time value and if its more then 3 days you must send notification to that user.
I've build a simple task management webapp: User A fills up a form, hits submit button, sends data to a server and if the data validates User B gets assigned to this task.
I'd like to notify User B by email on this new assignment. However User A can alter the task data or even delete the task and the email that already has been sent would be incorrect in this case.
One approach is to delay the notification email for couple of minutes and then upon sending update the email message if needed.
Which are the best practices for notifications sending?
I think you have a few choices:
Send out emails whenever task status changes. Don't include details; send a link to user B to let them see what the changes are.
This is a good example of Why Starbucks Does Not Use Two Phase Commit. User B will tolerate "dirty reads" because they aren't life altering.
Send out all notification emails asynchronously on a fixed schedule. Have a timed task query a database, generate all the emails, and send them at once. The task will have the chance to only send the latest one. If user A assigns a task, makes updates, then deletes, user B will only get the last meaningful one. In this case, an assign followed by a delete might result in no email being sent. Only an assign or update as last state will result in an email being sent.
at previous hour we reached the number of maximum limit of sending emails per hour which is not surprising since we know our limit per hour to send. However, after an hour passed I assumed that the rest of the emails will be sent automatically. It did not work that way. Now I have over 800 per hour to send and I sent 0 in this hour, at the same time, I see that 139 emails are backlogged from previous hour. Could you please help me how can I send those?
For everyone with a new account (and not over the hourly threshold) and still getting this problem, Mandrill can sometimes wrongly think your account is sending suspicious activity.
To check if this is the case go to the mandrill dashboard and in the bottom left click support. There should be an alert informing you to complete an account review.
You'll want to reach out to Mandrill support so they can look at your specific account. There's not enough information here about the API calls you're making or your account to be able to say what's happening.
It should be something related to your api if you are using api to send. Otherwise mandrill sends them right away as soon as you reach to next hour!
If you have just signed up for madrill then it usually takes longer time to prove your genuinity.
I suggest you to send a email with your details to help#mandrill.com and they will resolve it Max. 3 working days!
I did the same and they reverted within 30 hours and my mails are a breeze now!
I am looking to send emails that will delete after a given amount of time at their destination, giving them only a certain amount of time to respond. I will be sending these emails to people who have different email clients, so a client side solution seems impossible. Is there any sort of way to do this?
No, there is no possibility of doing so. You can only make the content somehow expire by for example:
Providing some link, that won't be avaliable after the period of time
Embedding message in form of html, which simply displays image from your webserver and after this period - change the image to something saying "time is up"
I am creating a reminder application that will allow users to remind user to send sms or email. at any day in the future.For example a user wants that the app reminds it for the birthday of a friend in the future.So the app would remind the user that day and show the user some prestored text to send as sms or email.
Can you suggest a good way to schedule these reminders for my app?
One of the ways I came up with was to schedule local notifications each day but I don't know if that would work.