Email Server Configuration
From AlfrescoWiki
Back to Server Configuration
Contents |
[edit] Introduction
Available in 2.9 Community and 2.2 Enterprise onwards.
Alfresco supports the ability to email content directly to specific nodes. This document will
- highlight the basic components that make this possible,
- give details of the types of behaviour that can be expected,
- describe the use of Group Permissions and
- describe the samples and how to start and test the email server.
This document assumes knowledge of how to extend the repository configuration.
[edit] Configuration
There are two methods of running Alfresco Server.
[edit] In-Process Email Server
The first is to run the Email Server process in the same JVM context as the repository itself.
To enable this mode, locate and unzip the sample configuration in custom-email-server.sample.zip. This will provide two files; custom-email-server-context.xml and custom-email-server.properties. The properties file can be modified to change the behaviour of the Email Server and Email Service.
<ext-config>/alfresco/extension/custom-email-server.properties
# # Alfresco Email Service and Email Server # # Enable/Disable the inbound email service. The service could be used by processes other than # the Email Server (e.g. direct RMI access) so this flag is independent of the Email Service. email.inbound.enabled=true # The username to authenticate as when the sender address is not recognised #email.inbound.unknownUser=anonymous # Email Server properties email.server.enabled=true #email.server.port=25 #email.server.domain=alfresco.com # # A comma separated list of email REGEX patterns of allowed senders. # If there are any values in the list then all sender email addresses # must match. For example: # .*\@alfresco\.com, .*\@alfresco\.org #email.server.allowed.senders= # # A comma separated list of email REGEX patterns of blocked senders. # If the sender email address matches this then the message will be rejected. # For example: # .*\@hotmail\.com, .*\@googlemail\.com #email.server.blocked.senders=
[edit] Remote Email Server
The second is to run the Email Server remotely and have it communicate with the repository over RMI.
TODO: Sample config
[edit] How Email Messages are Handled
When sending an email to the Email Server, the 'to' address is resolved to a node in the system in one of two ways.
[edit] Directly Referenced Nodes
If the sys:node-dbid is known, then the node can be addressed directly:
45634@alfresco.com 483@alfresco.com
You can enable the display of an object's DBID to make it easy to identify an object for email purposes.
[edit] Node Aliases
A much more convenient method of addressing nodes is by using an email alias (Email Alias aspect or emailserver:alias). On a space or file, use the Run Action functionality to add the Email Alias aspect. Edit the space or file's properties and give the node an email alias. For example, the administrator may add a Space called Inbox to handle inbound emailed content.
Email Alias: Inbox
The Space can be addressed directly:
Inbox@alfresco.com
[edit] Message Handling by Target Node Type
The following table shows the default behaviours for an incoming email to different types of referenced node. The behaviour can be modified or extended by adding in custom handlers:
- Folder(Space)
- Content added with emailed aspect.
- Forum(Discussion)
- Content specialised to Post with emailed aspect; if email subject matches a topic, then add to topic, otherwise create new topic based on subject.
- Topic(Post)
- Content specialised to Post with emailed aspect; if referenced node is a Post, add to Post’s parent Topic.
- Document(Content)
- If discussion exists, same as for forums, otherwise add discussion with email as initial topic and post.
[edit] Groups and Permissions
As email arriving at the Alfresco email server is unauthenticated. An authentication group, GROUP_EMAIL_CONTRIBUTORS , must be created to allow permissions to be handled at a high level by the administrator. When an email comes into the system, the only identification is the sender's email address. The user is looking-up based on the email address.
- If a matching user is not found, then the current user is assumed to be unknown, if unknown exists.
- If unknown doesn't exist, then the email is rejected as authentication will not be possible.
- If the user selected is not part of email contributor's group, then the email is rejected.
The current request's user is set and all subsequent processes are run as the authenticated user. If any type of authentication errors are generated, then the email is rejected. The authentication will also imply that the authenticated user may not have visibility of the target node, in which case the email is also rejected. Effectively, the target recipient of the email doesn't exist - at least not for the sender.
Current default server configuration creates EMAIL_CONTRIBUTE group and adds “admin" user to this group.
[edit] Configuration
The email service is configured via the email-service-context.xml file in the WEB-INF\classes\alfresco folder. Email server is able to run on separate JVM and server interacts with Alfresco Server with the help of RMI system. RMI is configured with via remote-email-service-context.xml config file.
[edit] Remote-email-service-context.xml
The configuration file contains “emailService" bean which specifies the related RMI configuration:
- <serviceUrl> </serviceUrl>
- - Specifies the valid RMI Url. Full description you can read at springframework site: http://www.springframework.org/docs/api/org/springframework/remoting/rmi/RmiProxyFactoryBean.html
- <serviceInterface></ serviceInterface>
- - Specifies the interface which is used for RMI.
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<bean id="remoteEmailServiceProperties" singleton="true"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="ignoreUnresolvablePlaceholders">
<value>true</value>
</property>
<property name="locations">
<list>
<value>classpath:alfresco/remote-email-service-test-context.properties</value>
</list>
</property>
</bean>
<bean id="emailServer" class="org.alfresco.email.server.impl.subetha.SubethaEmailServer">
<constructor-arg>
<ref bean="emailServerConfiguration"/>
</constructor-arg>
</bean>
<bean id="emailServerConfiguration"
class="org.alfresco.email.server.EmailServerConfiguration">
<property name="domain" value="alfresco.mycompany.com" />
<property name="port" value="25" />
<property name="enabled" value="true"/>
<property name="blockedSenders">
<list>
<value>*mail.ru</value>
</list>
</property>
<property name="allowedSenders">
<list>
<value>*alfresco.com</value>
</list>
</property>
<property name="emailService">
<ref bean="emailService" />
</property>
</bean>
<!-- Remote email-service. -->
<bean id="emailService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
<property name="serviceUrl">
<value>rmi://${email.service.remote.host}:${email.service.remote.port}/emailService</value>
</property>
<property name="serviceInterface">
<value>org.alfresco.service.cmr.email.EmailService</value>
</property>
<property name="refreshStubOnConnectFailure">
<value>true</value>
</property>
</bean>
</beans>
[edit] Email-service-context.xml
Configuration file defines spring beans. Properties of the bean with id = “emailServerConfiguration" contains values for email server configuration:
- <domain> </domain>
- - Specifies the domain e.g. alfresco.mycompany.com
- <port> </port>
- – Specifies the port that the email server listens for incoming connections on. Defaults to port 25. On some platforms ports below 1024 require the server to be run under a privileged account.
- <blockedSenders></blockedSenders>
- - Specifies the domains of block list.
- <allowedSenders></ allowedSenders>
- - Specifies the domains of allow list.
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<bean id="emailResourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.messages.email-service</value>
</list>
</property>
</bean>
<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
<property name="service">
<ref bean="emailService"/>
</property>
<property name="serviceInterface">
<value>org.alfresco.service.cmr.email.EmailService</value>
</property>
<property name="serviceName">
<value>emailService</value>
</property>
<property name="registryPort">
<value>${avm.remote.port}</value>
</property>
</bean>
<bean id="emailService" class="org.alfresco.email.server.EmailServiceImpl">
<property name="mailInboundEnabled">
<value>${mail.inbound.enabled}</value>
</property>
<property name="unknownUser" value="admin" />
<property name="emailMessageHandlerMap">
<map>
<entry key="folder">
<ref bean="folderEmailMessageHandler"></ref>
</entry>
<entry key="forum">
<ref bean="forumEmailMessageHandler"></ref>
</entry>
<entry key="discussion">
<ref bean="forumEmailMessageHandler"></ref>
</entry>
<entry key="topic">
<ref bean="topicEmailMessageHandler"></ref>
</entry>
<entry key="post">
<ref bean="topicEmailMessageHandler"></ref>
</entry>
<entry key="content">
<ref bean="documentEmailMessageHandler"></ref>
</entry>
</map>
</property>
<property name="nodeService">
<ref bean="nodeService" />
</property>
<property name="searchService">
<ref bean="searchService" />
</property>
<property name="retryingTransactionHelper">
<ref bean="retryingTransactionHelper" />
</property>
</bean>
<bean id="emailServiceTransactionInterceptor"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="importMessage">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<bean id="folderEmailMessageHandler"
parent="emailMessageHandlerBase"
class="org.alfresco.email.server.handler.FolderEmailMessageHandler" />
<bean id="forumEmailMessageHandler"
parent="emailMessageHandlerBase"
class="org.alfresco.email.server.handler.ForumEmailMessageHandler" />
<bean id="documentEmailMessageHandler"
parent="emailMessageHandlerBase"
class="org.alfresco.email.server.handler.DocumentEmailMessageHandler" />
<bean id="topicEmailMessageHandler"
parent="emailMessageHandlerBase"
class="org.alfresco.email.server.handler.TopicEmailMessageHandler" />
<bean id="emailMessageHandlerBase" abstract="true">
<property name="authenticationService">
<ref bean="authenticationService" />
</property>
<property name="authenticationComponent">
<ref bean="authenticationComponent" />
</property>
<property name="nodeService">
<ref bean="nodeService" />
</property>
<property name="personService">
<ref bean="personService" />
</property>
<property name="searchService">
<ref bean="searchService" />
</property>
<property name="contentService">
<ref bean="contentService" />
</property>
</bean>
<bean id="emailServerConfiguration"
class="org.alfresco.email.server.EmailServerConfiguration">
<property name="domain" value="alfresco.mycompany.com" />
<property name="port" value="25" />
<property name="enabled" value="false"/>
<property name="blockedSenders">
<list>
<value>*mail.ru</value>
</list>
</property>
<property name="allowedSenders">
<list>
<value>*alfresco.com</value>
</list>
</property>
<property name="emailService">
<ref bean="emailService" />
</property>
</bean>
<bean id="alisableAspect"
class="org.alfresco.email.server.AliasableAspect"
init-method="initialise">
<property name="nodeService">
<ref bean="nodeService" />
</property>
<property name="searchService">
<ref bean="searchService" />
</property>
<property name="policyComponent">
<ref bean="policyComponent" />
</property>
</bean>
</beans>
Categories: 2.2 | 2.9 | Email



