E-mail tasks: configuration, processing engine and scheduling
Data model of e-mail tasks, sources and processing adapters, save validation, schedule synchronisation, manual and background runs, and the gaps in permissions and content scope.
An e-mail task is a configuration-driven, folder-based document processor: source (Gmail API, Gmail IMAP, MS365), processing adapter, target storage (Drive, document centre folder, company folder or local directory) and schedule. Runs are executed by the e-mail task engine, either manually or by the scheduler's email_task job.
Data model
Table names carry the installation's own prefix in the database.
| Table | Role | Relation |
|---|---|---|
emailtask | task: code, name, source and login, filters, handler, params_json, folders, target, timing, status | target company |
company_folder | company Drive folders by type | company |
cron_queue | the task's scheduler template | payload email_task_id |
Processing adapters (whitelist): store_only, link_invoice, nemzetiutdij, rackforest, otpkelfo, googlews, anthropic, foxpost, github, ingatlancom.
Saving and running
- Validation: code
[a-z0-9_-]{2,32}, unique (empty = handler name); name; source-dependent required fields (IMAP password and MS365 secret only when adding, write-only); whitelisted handler; valid JSON parameters; required processed folder; target storage (local path or document centre/company folder; not needed foringatlancom); shared timer (5–1440 minutes, weekday, monthly 1–28). - After saving,
syncSchedulecreates, updates or deactivates the cron template (deactivates for an inactive task, missing target company or wrong interval). For a new row the ID is written back. runnow: the engine runs at once within the time budget (job_sync_budget, default 8 s) and queues the rest for continuation; error for an inactive task.delete: deletes the tasks and their cron templates.- Helpers:
folders(mailbox folders with the given login),companyfolders,drivefolders(at most 20 matches),addfolder,companyaccount(thin forward to the document centre's storage endpoint withctx=emailtask). - Background:
email_taskjob → catalogtask/emailtask::processForCronqueue; the payload'semail_task_idnarrows to one task, company and time come from the task.
Error keys
error_code, error_code_exists, error_gmail_account, error_imap*, error_ms365*, error_handler, error_params_json, error_processed_required, error_storage_configuration, error_v2_migration, error_task_inactive, error_schedule_missing, error_interval.
Permissions
list(unclassified);addhas no catalogue row, soeditdecides (canSave);editon all other endpoints;delete;debug. The BASE keystatusdeletehas no endpoint; its behaviour cannot be determined.- Content scope (
companyInScope) only oncompanyfolders,drivefoldersandaddfolder. The list query does not narrow to the allowed companies.
Known limitations
The list shows tasks of every company without content scope; saving and running do not check the content scope of the target company.