cancel
Showing results for 
Search instead for 
Did you mean: 

Inbound Emails: retrieve values from the header

matthew_walters
Champ in-the-making
Champ in-the-making
I've set up Alfresco to accept inbound emails.
I would like to do specific actions if the email's header contains certain key-values, such as Auto-Submitted with any value other than 'no'


Is it possible for me to get access to the email's header through Alfresco to check what value (if any) it contains for certain keys?


Thanks,
Matthew
6 REPLIES 6

mrogers
Star Contributor
Star Contributor
Yes its possible.   Normally the first port of call is metadata extraction.   There are already metadata extraction for various email mime types.    So you can take your header fields and put it into an alfresco property.   And then you can have a policy that runs on the value of that property or aspect.

Should I be adding this property to the "cm:emailed" aspect in ContentModel.xml?

You could.  But I'd be tempted to leave that aspect alone and add your own.

matthew_walters
Champ in-the-making
Champ in-the-making
I can't seem to get this working, I'm using a email header property that I know has a value when i send a test email:
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7

For now, I'm just modifying the cm:emailed aspect, adding the following to it:

<property name="cm:User-Agent">
<title>User-Agent</title>
<type>d:text</type>
</property>


But after saving and restarting alfresco, when i send a test email, it's not recognizing the new property.
When I click on the email in the folder, I don't see the name "User-Agent" (or the value)  in the email data in the properties.
When I look at the email document with the utility program CMIS Workbench, I can see that the property 'User-Agent' is defined for aspect 'cm:emailed', but has no value.

How exactly is this property used?  Is there somewhere else where I need to configure what 'cm:User-Agent' refers to in the email header?

mrogers
Star Contributor
Star Contributor
Have you configured metadata extraction for your custom property?

You probably also need to configure the metadata extracter.

Add the following line.

User-Agent=cm:User-Agent   

to your RFC822MetadataExtracter.properties

matthew_walters
Champ in-the-making
Champ in-the-making
My installation of Alfresco (Community 4.0d) doesn't contain the file RFC822MetadataExtracter.properties

Should I create it and put it on the classpath?