Documentation

Find documentation for our Joomla extensions on this page.

JoomHelpdesk - Cron Jobs and Auto-Close Guide

This guide covers JoomHelpDesk's background job system, including automatic ticket closing, email-to-ticket checking, log management, and the system plugin alternative.

1. Overview

JoomHelpDesk uses a cron system to run background tasks at scheduled intervals. Tasks are stored in the #__joomhelpdesk_cron database table with their own class, parameters, interval, and last-run timestamp. Each time the cron runs, it checks for any task whose interval has elapsed since its last

and runs it.

The two built-in cron tasks are:

  • Auto-Close -- Automatically closes tickets that have been inactive for a configured number of days.
  • Email Check -- Connects to one or more email accounts (via IMAP or POP3) and converts incoming messages into new tickets or replies on existing tickets.

Both tasks log their activity so you can review what happened in the administrator backend.

2. Setting Up Cron

Cron URL

The cron endpoint is a frontend URL:

https://yoursite.com/index.php?option=com_joomhelpdesk&view=cron

When this URL is loaded, JoomHelpDesk checks the #__joomhelpdesk_cron table for any published tasks whose scheduled interval has elapsed. It runs up to 10 due tasks per request, logs the results, and exits. The page returns no visible HTML output -- it is designed to be called by an automated process.

Set up a system-level cron job (crontab on Linux, Task Scheduler on Windows) to request the cron URL at regular intervals. A common interval is every 5 minutes, but you can adjust this based on your needs.

Using wget:

*/5 * * * * wget -q -O /dev/null "https://yoursite.com/index.php?option=com_joomhelpdesk&view=cron"

Using curl:

*/5 * * * * curl -s -o /dev/null "https://yoursite.com/index.php?option=com_joomhelpdesk&view=cron"

Using PHP CLI:

*/5 * * * * php /path/to/joomla/index.php "option=com_joomhelpdesk&view=cron"

Tip: The cron URL does not produce any page output. Using -q (wget) or -s -o /dev/null (curl) keeps your cron log clean.

Option B: System Plugin (No Server Access Required)

If you do not have access to set up a server cron job, enable the System - JoomHelpDesk CRON plugin instead. See Section 7 for details.

Task Intervals

Each cron task has its own interval (in minutes) stored in the #__joomhelpdesk_cron table. Even if you call the cron URL every minute, each individual task only runs when its configured interval has elapsed since its last

. For example, an auto-close task with a 1440-minute (24-hour) interval will only execute once per day regardless of how often the cron URL is called.

3. Auto-Close Configuration

The auto-close task automatically closes inactive tickets. It finds tickets whose lastupdate timestamp is older than the configured number of days and that are in a status marked as eligible for auto-close.

Settings

Configure auto-close under Administrator > Components > JoomHelpDesk > Settings:

SettingKeyDescription
Automatically Close support_autoclose Enable or disable automatic ticket closing.
Auto-Close Duration support_autoclose_duration Number of days of inactivity before a ticket is closed. Tickets whose lastupdate is older than this many days (and whose status allows auto-close) will be closed.
Add to Audit Log support_autoclose_audit When enabled, an audit message is added to each ticket that is auto-closed, reading: "Ticket auto-closed after X days of inactivity." This creates a visible record in the ticket's message history.
Email User support_autoclose_email When enabled, an email notification is sent to the ticket owner when their ticket is auto-closed. Uses the Admin_AutoClose email template.

How It Works

  1. The cron runner calls the JoomhelpdeskCronAutoClose class.
  2. It queries for ticket statuses that are marked as eligible for auto-close (can_autoclose flag on the status).
  3. It finds all tickets in those statuses whose lastupdate is older than the configured duration.
  4. If neither audit nor email is enabled: A single bulk UPDATE query closes all matching tickets at once (fastest path).
  5. If audit or email is enabled: Each ticket is processed individually so that audit messages can be inserted and/or notification emails can be sent, then all tickets are closed in a single UPDATE.
  6. Closed tickets have their ticket_status_id set to the default closed status (def_closed) and the closed timestamp is set to the current date/time.
  7. The task logs how many tickets were found and closed.

Status Configuration

For auto-close to work, you must configure your ticket statuses:

  • At least one status must have the can_autoclose flag enabled. Tickets in these statuses are candidates for auto-close.
  • A status must be designated as the default closed status (def_closed). This is the status tickets are set to when they are auto-closed.

Configure statuses at Administrator > Components > JoomHelpDesk > Ticket Statuses.

4. Email Checking (Email-to-Ticket)

The email check task connects to configured email accounts, reads unread messages, and either creates new tickets or adds replies to existing tickets.

Requirements

  • PHP IMAP extension (php_imap) must be enabled. If IMAP is not available, JoomHelpDesk falls back to the Horde mail library (if installed at components/com_joomhelpdesk/cron/horde/).
  • An email account configured in Administrator > Components > JoomHelpDesk > Email Accounts with server, port, username, and password.

Email Account Parameters

Each email account has parameters that control how messages are processed:

ParameterKeyDescription
Server Address server IMAP/POP3 server hostname.
Port port Server port (e.g., 993 for IMAP SSL, 143 for IMAP, 110 for POP3).
Username / Password username / password Credentials for the mail account.
Server Type type Protocol type: imap or pop3.
Use SSL usessl Enable SSL connection.
Use TLS usetls TLS setting: enabled, disabled, or force no-TLS.
Validate Certificate validatecert Whether to validate the server's SSL certificate.
Limit to Received Address toaddress Optional filter: only process messages sent to these addresses (one per line).
Ignore Sender Address ignoreaddress Addresses to ignore. Supports wildcards (e.g., *@noreply.example.com).
Ignore Subject ignoresubject Subject line keywords to ignore (one per line). Messages containing these strings are skipped.
Allow Tickets From newticketsfrom Whether new tickets can only be opened by registered users or also by unregistered senders.
Only Import Replies allowrepliesonly When enabled, only email replies to existing tickets are processed. New ticket creation via email is disabled.
Allow Unknown Replies allowunknown Allow replies from email addresses not associated with the ticket's owner or CC list.
After Importing onimport What to do with processed messages: delete them or mark as read (IMAP only).
Closed Ticket Replies closedticket Behavior when a user replies to a closed ticket: (1) open a new ticket, or (2) ignore the email.
Confirm New Tickets confirmnew When enabled, new tickets created via email require admin confirmation before the user is notified.
Import as HTML import_html Import the HTML version of the email body instead of plain text (requires allow_raw_html_messages setting).
Default Category / Department / Product / Priority cat_id / dept_id / prod_id / pri_id Default category, department, product, and priority assigned to new tickets created from this email account.
Connect String Override connectstring Optional custom IMAP connection string to override the auto-generated one.

How It Works

  1. The cron runner calls JoomhelpdeskCronEMailCheck for each configured email account.
  2. It connects to the mail server and searches for unread (UNSEEN) messages.
  3. Messages are limited to prevent timeouts: 20 messages when running as the system plugin, 50 when running via the cron URL.
  4. For each message, the task:
    • Extracts headers (from, to, subject, date).
    • Skips bulk/auto-reply messages (detected via X-Autoreply, X-Autorespond, or Auto-Submitted headers).
    • Validates the To address against the account's filter list.
    • Validates the From address (skips the Joomla system email address and any ignored addresses).
    • Validates the subject against ignored subject keywords.
    • Parses the subject for a ticket reference (e.g., [REF-001]) to identify replies.
    • Looks up the sender's email against registered Joomla users.
    • Checks domain restrictions for unregistered senders.
  5. Based on the results:
    • Reply to existing ticket: The message body is added as a reply. If the sender is a handler, it is added as an admin reply. Handlers can include [[CLOSE]] in the message body to close the ticket.
    • New ticket from registered user: A new ticket is created and assigned to the matching Joomla user.
    • New ticket from unregistered user: A new ticket is created with the sender's email and name. A random password is generated for guest ticket access.
  6. File attachments are saved and linked to the ticket message.
  7. Inline images (CID references) are converted to JoomHelpDesk image links.
  8. Notification emails are sent (user creation confirmation, admin notification, etc.).
  9. Each processed message is logged in the email log table with its outcome status.

Email Result Statuses

The email log records one of these status codes for each message:

CodeMeaning
SKIP_READ Message was already read.
SKIP_TO To address did not match the account filter.
SKIP_FROM From address was ignored or is the system email.
SKIP_SUBJECT Subject matched an ignored keyword.
SKIP_REGONLY Account only accepts registered users and sender is unregistered.
SKIP_NOTREPLY Account only allows replies and message is not a reply.
SKIP_UNKNOWNEMAIL Sender not recognized as ticket owner, handler, or CC.
SKIP_BULK Bulk email or auto-reply detected.
SKIP_DOMAIN_RESTRICTED Sender's domain is restricted.
REPLY_REG Reply added from a registered user.
REPLY_UNREG Reply added from an unregistered user.
OPEN_REG New ticket opened for a registered user.
OPEN_UNREG New ticket opened for an unregistered user.

Handler Replies via Email

When a handler (support agent) replies to a ticket via email:

  • The reply is added as an admin message on the ticket.
  • If auto-assign settings are configured (assign on reply when no handler, or take ownership on reply), the handler is automatically assigned to the ticket.
  • Handlers can include the tag [[CLOSE]] anywhere in their reply to close the ticket. This only works if the replying handler is the ticket's primary assigned handler.

5. Cron Log

Viewing the Log

Navigate to Administrator > Components > JoomHelpDesk > Cron Log.

The cron log view displays a table with:

  • Task -- The name of the cron task that ran (e.g., AutoClose, EMailCheck).
  • When -- The date and time the task executed.
  • Title -- A summary title for the log entry.

Click on any row to view the full log output in a detail panel on the right side of the screen. The log includes step-by-step details of what the task did (how many tickets were found, which emails were processed, any errors encountered, etc.).

Filtering

Use the filter controls at the top of the page to narrow results:

  • Task -- Filter by a specific cron task name.
  • Date -- Filter by date.

Clearing the Log

Click the Clear Cron Log button to delete all cron log entries. A confirmation dialog will appear before deletion proceeds.

Log Retention

The setting support_cronlog_keep controls how many days of cron log entries are retained. The default is 5 days. Entries older than this are automatically deleted each time the cron runs. Set this to 0 to disable automatic cleanup (not recommended for production sites as the log table will grow indefinitely).

6. Email Log

Viewing the Log

Navigate to Administrator > Components > JoomHelpDesk > Email Log.

The email log tracks every email message processed by the email check task. The table displays:

  • Received -- When the message was first seen.
  • Subject -- The email subject line.
  • Status -- The processing result (e.g., "Ticket ID : 42 - REF-042, UserID : 5" or "Skipping as not a reply").
  • Sender -- The email sender address and name.
  • Last Seen -- When the message was last encountered (useful for messages that remain unread across multiple cron runs).
  • Log -- Hover to view the full processing log for that message, including all previous processing attempts.

Filtering

Use the filter controls at the top of the page:

  • Account -- Filter by email account.
  • Date -- Filter by date.
  • Status -- Filter by processing result status.

Log Retention

The setting support_emaillog_keep controls how many days of email log entries are retained. The default is 365 days. Entries older than this are automatically deleted each time the cron or email check runs. Set this to 0 to disable automatic cleanup.

7. System Plugin (joomhelpdesk_cron)

The System - JoomHelpDesk CRON plugin provides an alternative to setting up a server cron job. When enabled, it runs the cron task check on every frontend page load.

How It Works

The plugin hooks into Joomla's onAfterInitialise event. On every frontend page request (administrator pages are excluded), it calls the same Joomhelpdesk_Cron_Helper::runCron() method that the cron URL uses. The individual task intervals still apply, so tasks only execute when their configured interval has elapsed.

Setup

  1. Go to Administrator > System > Plugins.
  2. Search for System - JoomHelpDesk CRON.
  3. Enable the plugin.
  4. No additional configuration is needed -- the plugin has no parameters.

Considerations

FactorServer CronSystem Plugin
Reliability Runs on schedule regardless of site traffic. Only runs when someone visits the frontend site. If the site has no visitors, no tasks will execute.
Performance No impact on visitor page loads. Adds processing overhead to frontend page requests. Tasks run inline before the page is rendered.
Message limits Processes up to 50 unread emails per run. Processes up to 20 unread emails per run (reduced limit to keep page response times acceptable).
Recommended for Production sites with regular cron needs. Sites without server cron access, or low-traffic sites where occasional delays are acceptable.

Important: Do not enable the system plugin and a server cron job at the same time. The task interval tracking prevents duplicate

, but running both adds unnecessary overhead. Choose one method.

8. Troubleshooting

Cron is not running

  • Server cron job: Verify the cron job is configured and running. Check your server's cron log (e.g., /var/log/cron). Test the URL manually in a browser -- it should return a blank page with no errors.
  • System plugin: Confirm the plugin is enabled at Administrator > System > Plugins. Remember the plugin only triggers on frontend page loads, not administrator pages.
  • Task interval: Check the interval and lastrun values in the #__joomhelpdesk_cron table. A task will not run again until its interval has elapsed since the last run.
  • Published flag: Ensure the cron task is published (published = 1) in the #__joomhelpdesk_cron table.

Auto-close is not closing tickets

  • Verify auto-close is enabled (support_autoclose setting).
  • Check that the duration is set (support_autoclose_duration) and is a reasonable number of days.
  • Confirm that at least one ticket status has the can_autoclose flag enabled.
  • Confirm that a default closed status (def_closed) is configured.
  • Check the Cron Log for the AutoClose task entry to see what happened (e.g., "Found 0 tickets to close" means no tickets matched the criteria).

Email check is not working

  • IMAP not available: The cron log will show "mod_imap not enabled in php config". Enable the PHP IMAP extension in your php.ini and restart your web server.
  • Connection errors: The cron log will show IMAP error messages. Common issues include wrong server/port, incorrect credentials, SSL/TLS misconfiguration, or firewall blocking the connection.
  • No messages found: The task only reads UNSEEN (unread) messages. If messages are already marked as read, they will not be processed.
  • Emails being skipped: Check the Email Log for the specific skip reason. Common causes:
    • The sender address matches the Joomla system email or the JoomHelpDesk from address.
    • The sender is on the ignore list.
    • The subject matches an ignored keyword.
    • The account is set to registered users only and the sender is not a registered Joomla user.
    • The account only allows replies and the message subject does not contain a ticket reference.
    • The sender's domain is restricted.
    • The message is detected as a bulk/auto-reply email.
  • Test the connection: Use the Test button in the email account configuration to verify connectivity and see the count of unread messages.

Logs are empty or missing

  • Check the support_cronlog_keep and support_emaillog_keep settings. If set to a very low number, logs may be cleaned up before you review them.
  • Verify the cron is actually running by checking the lastrun column in the #__joomhelpdesk_cron table.

Email attachments are not saving

  • Check that the attachments directory (components/com_joomhelpdesk/files/support/) exists and is writable by the web server.
  • For new tickets from registered users, the support_user_attach setting must be enabled.
  • For new tickets from unregistered users, the support_user_attach setting must be set to allow unregistered attachments (value > 1).
Cron Job Starts

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.

Ok