This document explains how email processing works inside the ATTMS Worker Service, specifically focusing on how support emails are parsed, how ticket creation is triggered, and which configuration settings and in-memory dictionaries are involved. It also documents how the EnableEmail flag is enforced and when memory needs to be refreshed after admin maintenance.
The Worker service runs an infinite loop inside ExecuteAsync().
var tD = StartupConfiguration.GetProtectedSetting("TimeDelay");
int timeDelay = Int32.Parse(tD) * 1000;- The loop waits for
timeDelay(loaded fromConfigStorein SQL at startup). - After each interval, it calls:
EmailManager.CheckEmail();In CheckEmail(), the following is executed:
secureEmailApiHelper.FetchAndProcessUnreadEmailsAsync();- This retrieves unread messages from the connected mailbox.
- For each message,
EmailManager.ProcessAddresses()is called.
The first step in ProcessAddresses() is to validate the recipients:
CheckSupportEmail(emailApiHelper);If this returns -1, the email is dropped and marked as read. This happens under several conditions:
- Subject is fewer than 4 characters
- Subject contains words from
StartupConfiguration.subjectExclusions - Sender matches
StartupConfiguration.senderExclusions - Support address is not in
StartupConfiguration.supportDistros
supportDistrosis loaded from theCustomerSettingsSQL table at startup or refresh time.- Only rows where
EnableEmail == trueare included.
If EnableEmail is unchecked (set to false), the corresponding support address is excluded from the memory dictionary, and any emails to that address will not be processed.
No TO: address match found in supportDistro Dictionary
No CC: match for support-test2@domain.com in supportDistro Dictionary
If a valid Support Distro is found:
- If the subject contains an open AutoTask ticket number → it is updated
- If no ticket number → a new ticket is created with:
- Subject → Ticket Title
- Body → Ticket Description
Duplicate subject logic prevents re-creation.
AutoAssignment is controlled via StartupConfiguration.autoAssignCompanies:
- Loaded from SQL where
AutoAssign == true - Used to decide whether the ticket should be auto-assigned
| Dictionary | Loaded From | Needs Refresh After |
|---|---|---|
supportDistros |
SQL CustomerSettings |
✅ SupportEmail, EnableEmail |
autoAssignCompanies |
SQL CustomerSettings |
✅ AutoAssign |
Companies.companies |
AutoTask API | ✅ AutoTask company sync only |
EnableEmailis enforced by excluding companies at load time fromsupportDistrosCheckSupportEmail()never checks EnableEmail directly — it is pre-filtered- Any admin changes to customer config should trigger a refresh of the appropriate dictionaries