schedule email to send at a later date using nodemailer/node-cron - node.js

I have a private beta sign up field that will instantly send an email notifying the user to look out for an approval email with a special key to sign up then send out an email with the special key at a later scheduled date.
send.pre_approval(function(){
new Cron({
cronTime: // some later time,
onTick: function(){
send.approval()
this.stop()
}
}).start()
})
send.pre_approval will send out the pre_approval email immediately upon signing up for the private beta. The cron job is set to fire some time later and the onTick function that fires at the set cronTime will send out the approval email then call its stop method.
This seems to work as I expected but I was wondering if this is the way to stop the cron job using node-cron.
I'm essentially scheduling a job and stopping it once it runs, it seems like the better way would be to schedule the job to run at a later time from the sign up time, any ideas?

My co-worker brought up a better solution that makes more sense.
Schedule a cron job that checks the creation_date field of a user that signs up and after a set amount of time has passed since the creation_date send out an email.
This way there is not a cron job for each user.

Related

Send Reminder to User and inform him about his plan expiry Django

Hi I want to create a payment plan expiry reminder using django
Current Solution
Create a management command
Run the management command as a cron job
Problems with the Current sollution
in windows cron job doesn't work
it will run at particular time for all the users
I don't want to run cron for every minute
But i want to notify the user when 50%,30%,20%,10% and 5% time is remaining.
What I'm looking for
I'm trying to do something that can be done using the expiry_date ('available in the membership model of user and plan ')
using which we can just look at the membership which are expiring and notify them only.
final and most important i don't want to run a cron job every minute , but want to achieve a functionality which lets the user even remind that you have just 10mins remaining ,5 mins remaining kind of notifications.
as the process is for learning I'm not looking for any paid API's

How to send a verification email and apply a cron job for every 2 hours until the user get verifed in nodejs?

https://github.com/yashtiwari-kiwi/Library-Management-System/tree/task
please find the link of my repositery and help me with the question.
So i need to implement the cron job in emailVerify function in /src/controllers/user.controllers
Hence i need to send repeated email to client at 2 hour interval until the db verifiedEmail get true Please help me??
I think it would be easier to query your user database every 2 hours for a predefined property for example "isVerified" with one cron job. And then send an E-mail to all the users that are not verified.

How to set a timeout for a stripe session checkout?

Is there a timeout for a customer to make their payment and can it be changed ?
Let me explain my situation :
I have to add the payment on a PHP booking platform.
To ensure that a time slot is not reserved several times, the platform blocks the reservation for 20 minutes when the user clicks on the reserve button. If he has not completed filling in his information after this time, he must start again or if he does not finish, the reservation is released.
I should be able to make sure that the payment is a maximum of 5 minutes long. In this way, I initiate the payment after maximum 15 minutes after the start of the reservation.
It’s the easiest way I’ve found to not touch up the whole code. Unfortunately, I can't find this option in the API.
Otherwise, if I block the reservation permanently before the payment process, I have no method to unblock it if the user does not complete the transaction by closing their browser.
When a Checkout Session is created it has a Payment Intent associated with it. You can cancel that Payment Intent when you release the reservation, which will prevent the customer from paying.
Update: You can now set expires_at when creating the Checkout Session:
The Epoch time in seconds at which the Checkout Session will expire. It can be anywhere from 30 minutes to 24 hours after Checkout Session creation. By default, this value is 24 hours from creation.
You can also now explicitly and immediately expire a Checkout Session using the dedicated "Expire a Session" API endpoint.

Email if a cron job succeeds on Cronitor

Is it possible to add a setting on Cronitor that sends an email once a cron job succeeds. Right now I only get email if a cron job fails.
This is what i have at the moment :
Alert preferences Failure tolerance Duration alerts
Alert notes
(X) Send alerts any time there is a problem
() Only send alerts if my job has consistently not run when expected...
I tried to email/contact support but now answer from Cronitor yet.
I'm one of the creators of Cronitor. I'm really sorry we somehow missed your support inquiry.
The answer is that, yes, this is possible but you cannot set this up without an API call. After the initial setup is complete (and the new alert rule is added) you can continue managing the monitor from the dashboard.
If you email support#cronitor.io again with specifics I can help you with adding this rule via the API.

How to schedule email newsletter

How to schedule an email newsletter? Documentation seems to missing that. I have newsletter with widget that will take news from last 2 weeks. I would like to automatically send that newsletter every 2 weeks.
Kentico 11
Re-sending newsletters based on some interval (e.g every week) is not supported in Kentico at this time. It is possible through some customization, however.
By scheduling a newsletter to be sent at some time in the future, a scheduled task is created in the Scheduled Tasks application (under your site > System Tasks). This task only runs once and is then deleted, but you can alter the configuration of the task to run periodically and not delete itself. Or, you can manually create a task that uses CMS.Newsletters.QueueSender and TaskData equal to the issue's GUID.
There is another issue to solve once the task has been scheduled to run periodically- the issue's IssueStatus will be changed to Finished (5) after it is sent the first time, but the QueueSender will only re-send the issue if the status is ReadyForSending (1).
You can use an object event handler or custom scheduled task to automatically change the IssueStatus to 1 before the issue is sent once again.

Resources