EveryEmailImporter
EveryEmailImporter is a premium plugin for the EveryDataStore ECM platform and requires a valid license. Its purpose is to log into a specified email inbox and continuously monitor it. When a new unread email arrives, the importer captures it, extracts any attachments, and prepares them for structured archiving into a RecordSet within EveryDataStore. A cron job regularly triggers the EmailImporter to perform this task.
Process Workflow
- The EmailImporter logs into the designated mailbox and processes all new unread emails. Attachments from these emails are saved to a temporary directory called quarantineDir.
- An antivirus scanner checks all files in quarantineDir for viruses or malicious content.
- If cleared by the antivirus, the EmailImporter generates a JSON metadata file based on the mapping matrix defined in emailImporter.yml. This JSON file is copied to the FileImporter's designated input directory fileImporterDir.
- The EveryFileImporter then takes over and archives the attachments along with the associated metadata into the defined target RecordSet in EveryDataStore.
Configuration
To configure the EmailImporter for a specific mailbox, edit the settings in the EveryEmailImporter section as follows:
EveryEmailImporter:
mailbox:
# Your mailbox host and folder
host: '{imap.example.com:993/imap/ssl}INBOX'
# Your mailbox username
user: 'user@example.com'
# Your mailbox password
pwd: 'password'
# Temporary directory to save email attachments
attachmentDir: /full/path/to/your/project/tmp
# Directory used by antivirus scanner
quarantineDir: /full/path/to/your/project/tmp/virusscanner/
# FileImporter input directory
fileImporterDir: /var/www/invoicing/
# Log directory for EmailImporter
logFileDir: /full/path/to/your/project/log/emailimporter/
recordSet:
# Target RecordSet slug
slug: 'b078e3a652270600cafb'
# Mapping of RecordSet form fields with email data
mappingItemData:
# UploadField slug where files will be archived
uploadField: '0f049e348cbaa848345c'
# Slug for the sender's name
senderName: '4bda98b71a93ee2aadb7'
# Slug for the sender's email address
senderEmail: '07e283df0e0d4f8868f2'
# Slug for the recipient's email address
recipientEmail: '4eee087dbbade816aead'
# Slug for the email subject
subject: '9f455a95cf7002131c21'
# Slug for the email body/message
message: '1e22d305eefa0bc4441e'
# Slug for the email's date
date: '4f61cdd7752a985088f9'
Execution via Cron Job
To enable continuous operation, schedule the following cron job to trigger the EmailImporter every 5 minutes:
*/5 * * * * cd /full/path/to/your/project; php vendor/silverstripe/framework/cli-script.php EmailImporter
This configuration ensures your system stays up-to-date with the latest incoming emails and attachments, securely archiving them in your EveryDataStore RecordSets.