Open-Up / workshop-ifi-27-07-2018

Guiding IFI students on their way to their first free software contributions....
0 stars 3 forks source link

Write a WithPriority mailet #1

Open chibenwa opened 6 years ago

chibenwa commented 6 years ago

James relies on a plugin defined mail processing system. Units of this mail processing system aremailets and matcher.

A matcher represents a condition that an incoming email can satisfy. A mailet represent a treatment of an incoming email (modification of the mail and/or side effect).

James like other mail systems relies on a MailQueue in order to asynchronously process emails independently of SMTP sessions that had been generating them. The MailQueue supports priority. A priority is an integer ranging from 0 (LOW_PRIORITY) to 9 (HIGH_PRIORITY).

The priority of an email is held under the "MAIL_PRIORITY" mail attribute.

Your task is to create a WithPriority mailet in server/mailet/mailets in the mailets package.

To do so:

This mailet should take a priority configuration parameter being an integer ranging from 0 to 9 (included). Upon all other values, or if missing, an exception should be thrown.

Here is an example for it's possible configuration:

<mailet matcher="All" class="WithPriority">
    <priority>8</priority>
</mailet>

You will open a pull request on https://github.com/linagora/james-project .

See https://issues.apache.org/jira/browse/JAMES-2279