How to Set Up a Cron Job for Ratals Cart Recovery Emails
Author: Rob CuppettPosted On: Aug. 06, 2026Last Updated: Aug. 07, 2026
Ratals commerce can automatically send cart recovery emails to customers who add products to their shopping cart but leave the website before completing checkout. These messages provide customers with a convenient way to return to their saved cart and finish their purchase.
Customers abandon shopping carts for many reasons. They may become distracted, want additional time to consider the purchase, need to compare options, experience a checkout interruption, or simply forget that products were left in the cart. A cart recovery email gives those customers a direct path back to the items they were already interested in purchasing.
Cart recovery emails are not sent directly when a customer leaves the website. A cron job must run on your server to find eligible abandoned carts and send the configured messages. Once the cron job is set up, Ratals can manage the recovery process automatically without requiring an administrator to manually contact each customer.
The script responsible for processing cart recovery emails is located at:
Cart recovery email settings can be managed in the Ratals admin area. The entire cart recovery system can be enabled or disabled using the master status setting. When the master setting is disabled, no cart recovery emails will be sent, even if one or more individual messages are enabled.
Ratals supports up to three cart recovery emails. Each email can be enabled or disabled independently, allowing you to create a recovery sequence that matches your business and customer communication preferences.
Each message can have its own:
Status
Send delay
Email subject
Email body content
You may enable only the first email, use the first and second emails, or enable all three messages. Disabling an individual email prevents that message from being sent without affecting the other enabled messages.
The first recovery email is commonly sent within the first few hours after the cart becomes eligible for recovery. At that point, the customer has likely left the website, but the products and purchase may still be fresh in their mind.
A second message can be sent later that day or within the next day. This provides another reminder without contacting the customer immediately after the first email.
The third message can be sent several days later as a final attempt to bring the customer back. Some businesses choose to include a discount code in the third email as a last incentive to complete the purchase.
For example, you could configure the sequence as follows:
Send the first email after 120 minutes, which is 2 hours.
Send the second email after an additional delay, such as 1,440 minutes, which is 1 day.
Send the third email several days later and optionally include a discount code.
The best timing will depend on the products you sell and your customers' buying process. Lower-cost or frequently purchased products may benefit from a shorter recovery sequence, while expensive or highly considered purchases may require more time between messages.
Cart recovery delays are entered in minutes. Common delay values include:
60 minutes for 1 hour
120 minutes for 2 hours
360 minutes for 6 hours
720 minutes for 12 hours
1,440 minutes for 1 day
2,880 minutes for 2 days
4,320 minutes for 3 days
10,080 minutes for 7 days
The configured delay for each message determines when that email becomes eligible to send. This gives you control over how quickly customers are contacted and how much time passes between recovery attempts.
Because the messages are handled by a cron job, the actual send time will depend on how often the cron runs. For example, if an email becomes eligible at 1:00 p.m. but the cron job runs once per hour, the message will be sent during the next scheduled run.
Ratals also prevents cart recovery emails from continuing after the customer completes an order or unsubscribes from cart reminder emails. This helps ensure that customers are not asked to return to a cart after the purchase has already been completed or after they have requested that the reminders stop.
First, enable the master Cart Recovery Emails setting. This controls the entire feature. If the master setting is disabled, the cron script may still run, but it will not send cart recovery messages.
Next, configure each email you want to use. Ratals supports up to three messages, and each message can be enabled or disabled independently.
For each enabled email, review and configure:
The email status
The send delay
The email subject
The email body content
Enter each delay in minutes. The delay begins when the shopping cart is created. Ratals then waits the configured number of minutes before that email becomes eligible to send.
Ratals also includes a two-hour processing window when checking eligible carts. If a cart has exceeded the configured delay by more than two hours, the email will no longer be sent. This prevents older abandoned carts from suddenly receiving recovery emails if the feature is enabled later or if the cron job has not been running.
You are not required to use all three messages. A simple recovery process may use only one email sent a few hours after the customer creates a shopping cart. A more complete sequence may use all three emails over several days.
Planning the Three-Email Recovery Sequence
The first email should normally be a helpful reminder rather than an aggressive sales message. The customer has already shown interest by adding products to the cart, so the goal is to make returning and completing checkout easy.
A first message sent within a few hours can remind the customer that the cart was saved and provide a link back to it.
The second email can be used as a follow-up if the customer still has not completed the purchase. This message may answer common concerns, remind the customer about product availability, or simply provide another convenient link to the saved cart.
The third email is generally the final reminder. It can be sent several days later and may use stronger language, such as letting the customer know that the cart will not be held indefinitely or that product availability may change.
A reasonable starting sequence could be:
First email: 2 to 4 hours after the customer creates their shopping cart.
Second email: approximately 1 day later.
Third email: 2 to 4 days after the second message.
These are only examples. You can adjust the timing based on your average order value, product type, sales cycle, and customer behavior.
Using a Discount Code in the Final Email
Some businesses choose to include a discount code in the final cart recovery email. This can provide an additional reason for the customer to return when the first two reminders did not result in a completed purchase.
You can create a discount code in the Ratals admin area and include that code in the subject or body of the third email.
For example, the final message could offer a limited discount and include instructions for applying the code during checkout.
A discount is not required, and it may not be appropriate for every business. Repeatedly offering discounts can train customers to wait for an incentive before purchasing. For that reason, it is often best to reserve the discount for the final email rather than including it in the first recovery message.
You should also make sure the discount code's rules, expiration date, usage limits, and eligible products match the offer described in the email.
SMTP Sending Email Configuration
Cart recovery emails are sent using your website's primary SMTP email configuration. Before enabling cart recovery emails, make sure your SMTP settings have been configured and tested. If your website is already successfully sending emails such as customer account creation emails or order confirmation emails, then your SMTP settings are configured correctly.
The SMTP settings used by cart recovery emails are configured in the Ratals admin area under:
Admin > Website > Site Settings > Contact Information
Within that page, configure the settings under the Site Email Address & SMTP Email Setup section.
The email address configured there is used as the sender for cart recovery emails, along with the associated SMTP server settings. If SMTP has not been configured correctly, cart recovery emails will not be delivered.
Ratals sends automated emails through your configured SMTP server rather than using PHP's standard mail function. Using SMTP helps improve email deliverability by authenticating your messages with your mail provider and supporting modern email verification standards such as SPF, DKIM, and DMARC. These standards help receiving mail providers verify that your emails are legitimately being sent from your domain, increasing the likelihood that they are delivered to the inbox instead of being filtered as spam.
Setting Up the Cron Job Through cPanel
Log in to your cPanel account.
Find and open Cron Jobs.
Under "Add New Cron Job", select how often the command should run.
For most stores, running the cart recovery processor every hour is a good starting point.
In the command field, enter the PHP binary followed by the complete path to the script:
The PHP binary path may be different on your server. Common locations include:
/usr/local/bin/php
/usr/bin/php
Confirm the correct PHP path with your hosting provider or server administrator before saving the cron job.
Once the cron job is saved, cPanel will execute the cart recovery processor automatically according to the schedule you selected.
Some cPanel environments allow you to enter an email address for cron notifications. This may be useful while testing the setup, but you may want to disable routine notifications after confirming that the script runs successfully.
Setting Up the Cron Job Through SSH
If you have SSH access, you can add the cron job directly through the server's command line.
Connect to your server through SSH.
Open the cron editor:
crontab -e
Add the following entry to run the cart recovery email processor once per hour:
Save and exit the cron editor. The server will then run the script automatically according to the schedule.
If your server uses /usr/bin/php instead of /usr/local/bin/php, update the command accordingly.
Recommended Cron Schedule
For most Ratals websites, running the cart recovery email cron job once per hour is recommended. Cart recovery messages are often most effective when the first email is sent within a few hours, so an hourly schedule gives Ratals regular opportunities to find and process eligible carts.
You may run the cron less frequently, such as every two or four hours, if your recovery delays are longer and exact timing is not important. However, running it only once per day could cause a message configured for a short delay to be sent much later than expected.
Running the cron more frequently does not cause messages to be sent early. The script will only process a cart when the configured delay for the next enabled email has been reached.
The right schedule depends on the shortest email delay you configure. As a general rule, the cron should run more frequently than that shortest delay so eligible messages are not unnecessarily postponed.
Why This Cron Job Is Required
The cron job allows Ratals to check abandoned carts and send recovery emails automatically in the background. Without it, carts may become eligible for recovery, but no email will be sent.
Once configured, the script checks eligible carts, reviews the master and individual email settings, determines which message should be sent next, and sends the email when its configured delay has been reached.
The system also tracks previously sent messages so the same recovery email is not repeatedly sent for the same cart. If the customer completes checkout or unsubscribes from cart reminder emails, additional recovery messages are stopped.
By enabling the feature, configuring your email sequence, and running the cron job on a regular schedule, you can automatically reconnect with customers who showed purchase intent but did not finish checkout.
A well-planned cart recovery sequence can help recover otherwise lost sales while still giving you full control over message timing, content, discounts, and the number of reminders sent.
Rob Cuppett is the founder and lead engineer behind Ratals, bringing over 25 years of experience in digital marketing, software development, and business automation. He shares expert tutorials, practical guides, and insights to help business owners optimize, customize, and fully leverage software solutions to grow their businesses efficiently.
Why Ratals
Start free with the CMS, then add Commerce, ERP, or AI only when you need them. Each one activates on your existing installation - no migration, no replatforming, no rebuild - ever.
See how our single-data-model architecture lets your entire business run on one connected system instead of stitching together separate software applications.