In Alfresco Repository, mail files are stored as they are, in a single repository node that includes information about the body of emails and their attachments.
Some Enterprise add-ons, such as the Outlook Connector, add features to this default behaviour. For those users, this development is not recommended.
However, if you are using Community or Enterprise edition with no enhancements, this addon will allow you to extract mail attachments and to store them as separate nodes in the Alfresco Repository. For example, for an email with two attachments, you will get one node with the email body and two additional nodes with the files attached to it.
Alfresco Maven SDK
It's recommended to review this information from Alfresco Docs to understand deployment process:
Building this feature using the Alfresco Maven SDK requires creating a JAR file to be deployed inside the Alfresco Repository Web Application. In this case we are using the Maven "alfresco-platform-jar-archetype" to develop a Behaviour listening to the creation of new nodes. Note that our code will be executed by the Alfresco Repository every time a new node is created, inside the database transaction that is actually creating the node. For this reason, we need to be sharp to identify if the new node requires attachments extraction and we need to be extra careful to avoid breaking the file creation due to some unexpected exception in our code.
Source code is available in https://github.com/aborroy/alfresco-outlook-attachments
Follow this steps to build and deploy the project to a Docker Compose ACS 7.2 template:
$ git clone git@github.com:aborroy/alfresco-outlook-attachments.git $ cd alfresco-outlook-attachments $ mvn clean package $ cp target/alfresco-outlook-attachments-1.0.0.jar ../docker/alfresco/modules/jars
Alfresco Java SDK
It's recommended to review this information from Alfresco Docs to understand deployment process:
As an alternative, the feature can be built using the Alfresco Java SDK. In this case is not required to deploy any JAR file to Repository, we're creating a Spring Boot application that is consuming Repository Events from ActiveMQ. When a creation event is detected, the application will identify if that requires attachment extraction and it will update the Alfresco Repository using the REST API. Note that our code will executed outside the Alfresco Repository, once the transaction has been committed in the database. Since we're not affecting directly ingestion performance, we need to take care of the REST API calls generated to create email attachments.
Source code is available in https://github.com/aborroy/alfresco-outlook-attachments-oop
Follow this steps to build and run the application together with a running ACS 7.2 instance:
$ git clone git@github.com:aborroy/alfresco-outlook-attachments-oop.git $ cd alfresco-outlook-attachments-oop.git $ mvn clean package $ java -jar target/alfresco-outlook-attachments-oop-5.1.4.jar
Video recording
Additional details are provided in this video:
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.