The properties of /properties/config.properties for the configuration of email feeding (cf Configuring email feeding) are used in the configuration file /properties/domain/feed.xml.
SPAM filtering
It is possible to filter the SPAM in order to prevent from unwanted emails to create unwanted tickets, or to create tickets but close them automatically just after their creation.
Using predefined filters
Two beans implementing predefined filters are available in the distribution:
- subjectStartsWithSpamFilter, which considers an email as spam if it the subject starts with a given string
- subjectContainsSpamFilter, which considers an email as spam if it the subject contains a given string
In order to consider as spam all the messages starting with [SPAM] and delete them, set the following properties:
feed.imap.spamFilterBean=subjectStartsWithSpamFilter feed.imap.spamFilterPattern=[SPAM] feed.imap.deleteSpam=true
In order to consider as spam all the messages that contains the string *SPAM*, transfer them to category #5 and close them, set the following properties:
feed.imap.spamFilterBean=subjectContainsSpamFilter feed.imap.spamFilterPattern=*SPAM* feed.imap.deleteSpam=false feed.imap.spamCategoryId=5
Using several filters
In order to use several (predefined or added) filters, declare the filters in the configuration file /properties/domain/feed.xml, for instance:
<bean id="subjectStartsWithSpamFilter" class="org.esupportail.helpdesk.services.feed.imap.SubjectStartsWithSpamFilterImpl" lazy-init="true" > <property name="pattern" value="SPAM" /> </bean> <bean id="mySpamFilter" class="edu.domain.helpdesk.services.feed.imap.MySpamFilterImpl" lazy-init="true" />
Declare the filter delegatingSpamFilter of class org.esupportail.helpdesk.services.feed.imap.DelegatingSpamFilterImpl that delegates to the previously declared filters:
<bean id="delegatingSpamFilter" class="org.esupportail.helpdesk.services.feed.imap.DelegatingSpamFilterImpl" lazy-init="true" > <property name="filters" > <list> <ref bean="subjectStartsWithSpamFilter" /> <ref bean="mySpamFilter" /> </list> </bean>
Tell the application that the filter bean is delegatingSpamFilter in the configuration file /properties/config.properties:
#feed.imap.spamFilterBean=delegatingSpamFilter
Remember to allow the automatic recovering of the configuration file /properties/feed/feed.xml when upgrading (see Recovering previous configuration and customizations when upgrading).
Adding a new filter
Write a new class implementing the interface org.esupportail.helpdesk.services.feed.imap.SpamFilter and declare a bean of this class in /properties/domain/feed.xml.
Remember to allow the automatic recovering of the new class and the configuration file /properties/feed/feed.xml when upgrading (see Recovering previous configuration and customizations when upgrading).
Reading several IMAP accounts
In order to read several IMAP accounts, that may feed different categories, deployers must declare in the configuration file /properties/domain/feed.xml as many as necessary beans looking like the bean accountReader, and add them to the attribute mailReaders of the bean feeder.
For IMAP accounts on the same server, one may use:
<bean id="feeder" class="org.esupportail.helpdesk.services.feed.FeederImpl" lazy-init="true" > <property name="mailReaders" > <list> <ref bean="accountReader1" /> <ref bean="accountReader2" /> </list> </property> </bean> <bean id="abstractAccountReader" abstract="true" > <property name="server" value="${feed.imap.server}" /> <property name="folder" value="${feed.imap.folder}" /> <property name="messageReader" ref="messageReader" /> <property name="domainService" ref="domainService" /> </bean> <bean id="accountReader1" class="org.esupportail.helpdesk.services.feed.imap.ImapAccountReaderImpl" lazy-init="true" > <property name="address" value="${feed.imap.address1}" /> <property name="account" value="${feed.imap.account1}" /> <property name="password" value="${feed.imap.password1}" /> <property name="categoryId" value="${feed.imap.categoryId1}" /> </bean> <bean id="accountReader2" class="org.esupportail.helpdesk.services.feed.imap.ImapAccountReaderImpl" lazy-init="true" > <property name="address" value="${feed.imap.address2}" /> <property name="account" value="${feed.imap.account2}" /> <property name="password" value="${feed.imap.password2}" /> <property name="categoryId" value="${feed.imap.categoryId2}" /> </bean> <bean id="messageReader" class="org.esupportail.helpdesk.services.feed.imap.MessageReaderImpl" lazy-init="true" > <property name="domainService" ref="domainService" /> <property name="i18nService" ref="i18nService" /> </bean>
This way, the credentials can be set in the configuration file /properties/config.properties:
feed.imap.server=imap.domain.edu feed.imap.address1=support1@domain.edu feed.imap.account1=support1 feed.imap.password1=secret1 feed.imap.categoryId1=45 feed.imap.address1=support2@domain.edu feed.imap.account1=support2 feed.imap.password1=secret2 feed.imap.categoryId1=63
Remember to allow the automatic recovering of the configuration file /properties/feed/feed.xml when upgrading (see Recovering previous configuration and customizations when upgrading).
Other feed modes
IMAP account readers provided by default are of class org.esupportail.helpdesk.services.feed.imap.ImapAccountReaderImpl.
The steps to add new feed modes are:
- write a new class implementing the interface org.esupportail.helpdesk.services.feed.AccountReader
- declare a bean of this class in the configuration file /properties/domain/feed.xml
- Allow the automatic recovering of the new class and the configuration file /properties/feed/feed.xml when upgrading (see Recovering previous configuration and customizations when upgrading).
See also: Using the web service