# Core services

# Flush mail queue

The process of sending email is

1. Generate email and put in queue ("outbox")
2. Send email to recepient ("sent")

When status actions are executed or user notifications are triggered, the email queue is filled. Nothing happens before the queue is flushed, so this service is essential for communication through email.

Normally this service should run every 5 minutes. In special cases where a lot of emails are generated, som will find reasuring that is possible to pospone the sending of system generated emails. If some error occurs manual fixes on each email is still possible.

The following services are exempt from using the queue (are sent directly)

- Welcome information
- Password resets
- Server information status
- License information status

Recommended max service interval

- Only send emails: 2 minutes
- Generate documents and send emails: 10 minutes

## Configuration

\[If any configuration is available, and how to\]

## Developer info

- Classname: dk.p2e.blanket.services.ExecuteEmailQueue
- Default isActive:
- Default interval: 5

# Timed status actions

Status actions are actions bound to a certain status, that has its type set to "timed".

This service will execute the actions, and will log the results. The service ensures that each action is only executed once per item. Exception to this rule: Changing the status to another, and moving the status back, will reset the "execute only once" feature.

As the time granularity for timed actions is DAYS, suggested service interval is once or twice day (1440 or 720 minutes).

Recommended max service interval: 15 minutes

## Configuration

\[If any configuration is available, and how to\]

## Developer info

- Classname: dk.p2e.blanket.services.ExecuteStatusActions
- Default isActive:
- Default interval: 60

# Send notifications

Notifications are generated from different sources

- User alerts (flags with alerts activated)
- Fieldtype user: User was selected
- Fieldtype group: Group was selected
- Status action execution

### <span id="bkmrk-"></span><span class="mw-headline" id="bkmrk-user-alerts-%28flags-w-2">User alerts (flags with alerts activated)</span>

Users can create alerts by flagging items, and checking off Alert on status updates. Every time the item changes status, the corresponding users will be alerted.

### <span class="mw-headline" id="bkmrk-status-action-execut-1">Status action execution</span>

Status actions allows for notification of either groups or individual users. The message can also contain information from the data item in question and/or a link for the item.

## Configuration

\[If any configuration is available, and how to\]

## Developer info

- Classname: dk.p2e.blanket.services.SendUserNotifications
- Default isActive:
- Default interval:

# Import emails

The service will collect incoming emails and distribute them to each recognizable record.

The solution must contain a [Mailbox](https://wiki.tsnocode.com/index.php?title=FieldMail "FieldMail") field, which handles display of the incoming emails. Each record has a distinct email address, and in the field it is possible to specify which users are allowed to send emails to that type of record.

Before use a catch-all POP3 email address needs to be specified.

The account details should be entered in the policies

- mailDomain
- mailServer
- mailUsername
- mailPassword

Suggested frequency is 10-15 minutes.

## Configuration

\[If any configuration is available, and how to\]

## Developer info

- Classname: dk.p2e.blanket.services.ImportEmails
- Default isActive:
- Default interval:

# Attachment fetcher

Pick up files stored in emails on a certain IMAP account

\[Describe the function the service executes\]

## Configuration

\[If any configuration is available, and how to\]

## Developer info

- Classname: dk.p2e.blanket.services.email.EmailHandlerThread
- Default isActive:
- Default interval:

# Import holidays

Fetches holidays one year ahead and saves them

\[Describe the function the service executes\]

## Configuration

\[If any configuration is available, and how to\]

## Developer info

- Classname: dk.p2e.blanket.services.LoadHolidays
- Default isActive:
- Default interval:

# Maintain Resumes

Recalculates resume-values for a given list of entities

## Configuration

The list of entities to update on every run, is defined in the policy sagIDsForMaintainResumes.

The policy should contain a comma-seperated list of SagIDs to maintain.

## Developer info

- Classname: dk.p2e.blanket.services.MaintainResumes
- Default isActive: no
- Default interval: 1440 minutes (daily)