Wednesday, May 5, 2010

Upload Files to Alfresco via Email -- Inbound Emails

"Data Ingestion"  -- that's the process of getting files and data into your content management system, and Alfresco makes it easy.  My favorite example is being able to drag-and-drop to a mounted Alfresco CIFS drive.  Alfresco 3.2R also introduces drag-and-drop within IMAP-compatible email clients like Outlook, which is pretty slick.

But there's another option that you may not know about that has been part of standard Alfresco for a while and it's something that you may find to be very handy.  That's the uploading of emails sent to an Alfresco email address.  This feature lets users send emails with attachments to Alfresco for archival.  Only emails coming from designated users whose originating email address matches the email address that Alfresco knows from the user profile are accepted.  This is a great option for people out in the field to be able to simply email in data and files that they need to be stored in the Alfresco repository.

You still need to use the Alfresco explorer JSF client to set it up, but once you've got it setup, you can file data into the Records Management module, an Alfresco Share site document library, or anywhere in the repository.

Step 1 -- Setup and Start the Alfresco Email Server
Edit the file Alfresco/tomcat/shared/classes/  Change the section in the file called "Alfresco Email Server" as show below. Basically, I've uncommented the email.server.* and email.inbound.* properties.  For the variable email.server.domain, I entered the name of the server where Alfresco is running.  In my case, I am testing on an Amazon EC2 instance, so I've entered the Amazon Public DNS for my instance.

In this case, I've set the email.server.port value to 25.  You might want to verify that there is no email server already running on the Alfresco server machine and listening to port 25.

On Linux to check this, I run the following command:
netstat -nap --inet | grep 25

On Windows, you could just run netstat.

After making those changes, I stop and restart the Alfresco server.

# 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 Server properties 

# 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
# Allow anyone:

Step 2 -- Set Alfresco User Emails
Enable Alfresco users to be able to submit email uploads by starting up the Alfresco explorer client and going into the Admin area.  For each user that will be enabled for email submit verify that the email address entered in their Alfresco profiles match the address that they will be using when submitting emails.

Step 3 -- Add Users to the EMAIL_CONTRIBUTORS group
While still in the Alfresco administration area on the Alfresco explorer client, go into group administration.  Make sure that all users that are to be enabled to submit email uploads to Alfresco are part of the Alfresco group EMAIL_CONTRIBUTORS.

Step 3 -- Setup email aliases for Alfresco folders (spaces)
Identify which folders in Alfresco that you'd like users to be able to submit to.  To do that, navigate to each of the target folders in the repository.

For example, here is a new folder in my user home area that is called "Email Inbox"
On examination of the properties for this folder, you can see an entry called "Email ID".  This is really all you need for being able to send emails.  I can do an email upload submit by sending my email to this email address, like:

But it is somewhat nicer to be able to send to an email address that is easier to remember than just a number.

To create an alias for the Email ID numeric, you need to first add an aspect to the folder.
Run Action -> Add Aspect to Item. Select the "Email alias" aspect.

Once the aspect is added, you'll see something like this.
The property "Email Alias" is now available. By selecting edit for the properties, you can define an alias for the submit email name. For example, I can use 'inbox'. Note that the name you select is case sensitive. After doing that, I can submit emails to populate the folder associated with the alias name, like:

Step 4 -- Start sending Emails

Send an email to the Alfresco email server:, using the name appropriate for your system.
In this case I sent an email and an attachment called 'AlfrescoRMintro.txt'.

Then check the folder.  Both the email body (with name based on the email subject) and attachment have been uploaded to the folder.

Yes, that's really great.  If you look at the property page for this email, you'll see something like this:

There's only one thing that makes it not totally perfect.  On the property page for the email body, you can see the Attachments property with a link to the attachment document.  That's great, but it isn't a live link.  You need to manually go back to the folder level and find the attachment document.  It would nice to just be able to click right there to see the attachment.

Overall though this can be a very useful feature, and one not to forget about.


  1. Dick,

    Thanks for another great tutorial! Very thorough and much appreciated.

    Nancy Garrity
    Alfresco Community Manager

  2. Hi, thanks for the tutorial. Can we take this a step further? I have a BPM software that will generate a tender and email to 3 suppliers. I would like for the suppliers to reply to the email with their quotes and be able to store their replies in a common folder automatically.
    Thanks so much.