If your site becomes popular with TMail running at the backend, you'll need an efficient way to manage the large volume of emails you receive daily. Setting up a CRON job to delete old emails is a simple and effective solution.
Configure Delete Settings in Admin Panel:
Navigate to the Admin Panel of your TMail installation.
Set your preferred options for deleting old emails. TMail will follow these settings.
Set Your CRON Password:
In the Admin Panel, locate or set your CRON Password. This password will be used in your CRON job URL.
Create the CRON Job:
If you're using a control panel you can navigate to the CRON settings of your control panel OR if you're using TMail on VPS or Dedicated Server without a control panel, open your server's CRON configuration file. This can usually be done by running crontab -e
in your terminal.
Add the following line to schedule the deletion job. This example runs the job every minute:
* * * * * wget -O /dev/null -o /dev/null https://[YOUR_SITE_URL]/api/cron/[CRON_PASSWORD]
Copy code
* * * * * wget -O /dev/null -o /dev/null https://[YOUR_SITE_URL]/api/cron/[CRON_PASSWORD]
Replace [YOUR_SITE_URL]
with your actual site URL and [CRON_PASSWORD]
with your CRON Password from the Admin Panel.
If your site URL is example.com
and your CRON Password is yourpassword
, your CRON job would look like this:
* * * * * wget -O /dev/null -o /dev/null https://example.com/api/cron/yourpassword
Copy code
* * * * * wget -O /dev/null -o /dev/null https://example.com/api/cron/yourpassword
This setup ensures that old emails are deleted according to the settings you've configured, keeping your email system clean and efficient.
Ensure that the URL and password are correctly set to avoid any issues with the CRON job.
By following these steps, you can efficiently manage and delete old emails using CRON with TMail.