Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
Alfresco supports the ability to email content directly to specific nodes. For example you can email documents into an alfresco folder.
This document will
This document assumes knowledge of how to extend the repository configuration.
When sending an email to Alfresco's SMTP Email Server, the 'to' address is resolved to a node in the system in one of two ways.
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.
A much more convenient method of addressing nodes is by using an email alias (Email Alias aspect which contains the emailserver:alias property). 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. To set the email alias on the Space, do 'View Details' on the space, in the Properties section, if Email Alias is empty, click the edit on to top right - in line with Properties to provide the 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
Notes:
-Aliases are case sensitive.
-The property value within alfresco does not include the '@alfresco.com' part. So in the example above the Administrator adds 'Inbox' or 'Fred' as the alias. Emails going to Inbox@alfresco.com and Fred@alfresco.com are delivered accordingly.
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:
To implement your own handler, you'll need to implement org.alfresco.email.server.handler.EmailMessageHandler interface, or extend org.alfresco.email.server.handler.AbstractEmailMessageHandler. The key method to implement is
void processMessage(NodeRef nodeRef, EmailMessage message);
Then add the new handler to the Spring config by overriding the emailService bean from CONFIGROOT\emailserver\email-service-context.xml. More specifically, you'll need to add it to the property emailMessageHandlerMap. Here is a fragment:
<property name='emailMessageHandlerMap'>
<map>
<entry key='cm:folder'>
<ref bean='folderEmailMessageHandler'></ref>
</entry>
<entry key='cm:content'>
<ref bean='documentEmailMessageHandler'></ref>
</entry>
</map>
</property>
An experimental feature in Community 4.0 is authentication for SMTP.
If the user authenticates with the SMTP server then there is no need to match on the user's email address or check the EMAIL_CONTRIBUTORS group.
Authentication is turned on by setting the following property,
The following SMTP authentication methods are implemented: PLAIN, LOGIN, PASSWORD
An authentication group, EMAIL_CONTRIBUTORS , must be created to allow permissions to be handled at a high level by the administrator. By default the server creates EMAIL_CONTRIBUTORS group and adds “admin' user to this group.
Only alfresco accounts that are contained by EMAIL_CONTRIBUTORS can email via SMTP.
As email arriving at the Alfresco email server is unauthenticated. When an email comes into the system, the only identification is the sender's From email address. The alfresco user is looked-up based on the email address.
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.
STARTTLS is an extension to plain text communication protocols, which offers a way to upgrade a plain text connection to an encrypted TLS or SSLconnection instead of using a separate port for encrypted communication.
You can configure whether the SMTP server reports that it supports TLS, whether TLS is enabled or whether TLS is required by setting one of the below properties to true.
For STARTTLS support to work for inbound email, you must configure SSL for Java. You can identify if you are having this problem by turning on DEBUG logging for the class 'org.subethamail' in your log4j.properties file.
startTLS() failed: no cipher suites in common
The following process outlines one methodology for creation of a self-signed certificate and is adapted from [http://stilius.net/java/java_ssl.php]. However this may differ between JVM vendors, so consult your JVM documentation for more information if required.
1. Create a suitable key and certificate:
keytool -genkey -keystore mySrvKeystore -keyalg RSA
2. Add the following somewhere in your Tomcat configuration. In RHEL 5 this file would be located at /etc/tomcat5/tomcat5.conf for example.
JAVA_OPTS='$JAVA_OPTS -Djavax.net.ssl.keyStore=mySrvKeystore -Djavax.net.ssl.keyStorePassword=123456'
Note: This methodology explains how to create a self-signed certificate only. SSL vendors can provide certificates signed by an authority and may be more suitable for production use.
Alfresco versions 3.2+ are configured though alfresco-global.properties.
If the configuration of the subsystem needs to be overidden to add custom message handlers, then copy
InboundSMTP-context.xml to
<ext-config>/alfresco/extension/subsystems/email/InboundSMTP/inboundSMTP-context.xml
custom-repository.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
The inbound email service deals with incomming email messages.
the Email Server (e.g. direct RMI access) so this flag is independent of the Email Service.
The following properties are used to configured the inbound SMTP email server.
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
A comma separated list of email REGEX patterns of blocked senders. The list of blocked senders has priority over the allowed senders.
If the sender email address matches this then the message will be rejected.
For example:
.*\@hotmail\.com, .*\@googlemail\.com
There are two methods of running Alfresco SMTP email server.
The first is to run the Email Server process in the same JVM context as the repository itself. This is how practically everyone will run alfresco.
The second is to run the Email Server remotely and have it communicate with the repository over RMI. Note: details are not provided to configure the proxy. This may need updating for 3.2.
To enable the remote alfresco SMTP email server, 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.
custom-repository.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
Note: Details are not provided to configure and start the remote proxy.
The following sections are low level details that you should not need to touch.
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.
The configuration file contains “emailService' bean which specifies the related RMI configuration:
<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>
<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>
Configuration file defines spring beans. Properties of the bean with id = “emailServerConfiguration' contains values for email server configuration:
<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>
The following log4j setting will help to log the inbound smtp connection.
log4j.logger.org.subethamail.smtp.server.ConnectionHandler=debug
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.