Saturday, 20 October 2012

Alfresco 4 Community Set up Email


Set Global Properties - Ubuntu

Copied from Patrick Bailey 

Alfresco requires some additional installs to work.  Alfresco out of the box uses a few other tools like OpenOffice and ImageMagick.


Edit /etc/apt/sources.list.


 Ø  sudo vi /etc/apt/sources.list


Add the following at the bottom


deb http://archive.canonical.com/ lucid partner


Run this from the command line


 Ø  sudo apt-get update


Install these via apt-get


 Ø sudo apt-get install imagemagick
 Ø sudo apt-get install swftools
 Ø sudo apt-get install libjodconverter-java



Edit the /opt/tomcat/conf/catalina.properties file


 Ø  sudo vi +74 /opt/tomcat/conf/catalina.properties


Updated shared.loader to the following


 Ø shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar





In the /opt/tomcat/shared/classes directory there is an alfresco-global.properties.sample folder. Rename it


 Ø  cd /opt/tomcat/shared/classes
 Ø   sudo cp alfresco-global.properties.sample alfresco-global.properties



Now edit this file


  Ø  sudo vi alfresco-global.properties


Here is the file I made,  Make sure to edit the mail.* portion to an email account you have.


###############################
## Common Alfresco Properties #
###############################

#
# Sample custom content and index data location
#
dir.root=/alfresco/alf_data
#dir.keystore=${dir.root}/keystore

#
# Sample database connection properties
#
db.username=alfresco
db.password=passalfresco

#Disabled the guest login
alfresco.authentication.allowGuestLogin=false 

#
# External locations
#-------------
ooo.exe=/usr/bin/soffice
ooo.enabled=true
ooo.port=8100
img.root=/usr
img.dyn=${img.root}/lib
img.exe=${img.root}/bin/convert
swf.exe=/usr/bin/pdf2swf
jodconverter.enabled=true
jodconverter.officeHome=/usr/lib/openoffice
jodconverter.portNumbers=8100

jodconverter.officeHome=/usr/lib/openoffice/program/soffice
jodconverter.portNumbers=8101
jodconverter.enabled=true

#
# Property to control whether schema updates are performed automatically.
# Updates must be enabled during upgrades as, apart from the static upgrade scripts,
# there are also auto-generated update scripts that will need to be executed.  After
# upgrading to a new version, this can be disabled.
#
#db.schema.update=true

#
# MySQL connection
#
db.driver=org.gjt.mm.mysql.Driver
db.name=alfresco
db.url=jdbc:mysql://localhost/alfresco?useUnicode=yes&characterEncoding=UTF-8


#
# Oracle connection
#
#db.driver=oracle.jdbc.OracleDriver
#db.url=jdbc:oracle:thin:@localhost:1521:alfresco

#
# SQLServer connection
# Requires jTDS driver version 1.2.5 and SNAPSHOT isolation mode
# Enable TCP protocol on fixed port 1433
# Prepare the database with:
# ALTER DATABASE alfresco SET ALLOW_SNAPSHOT_ISOLATION ON;
#
#db.driver=net.sourceforge.jtds.jdbc.Driver
#db.url=jdbc:jtds:sqlserver://localhost:1433/alfresco
#db.txn.isolation=4096

#
# PostgreSQL connection (requires postgresql-8.2-504.jdbc3.jar or equivalent)
#
#db.driver=org.postgresql.Driver
#db.url=jdbc:postgresql://localhost:5432/alfresco

#
# Index Recovery Mode
#-------------
#index.recovery.mode=AUTO

#
# Outbound Email Configuration
#-------------
mail.host=smtp.gmail.com
mail.port=465
mail.protocol=smtps
mail.username=yourname@example.com
mail.password=yourpassword
mail.smtp.timeout=30000
# New Properties
mail.smtps.starttls.enable=true
mail.smtps.auth=true


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

# Email Server properties
#-------------
#email.server.enabled=true
#email.server.port=25
#email.server.domain=alfresco.com
#email.inbound.unknownUser=anonymous

# 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:
#-------------
#email.server.allowed.senders=.*

#
# The default authentication chain
# To configure external authentication subsystems see:
# http://wiki.alfresco.com/wiki/Alfresco_Authentication_Subsystems
#-------------
#authentication.chain=alfrescoNtlm1:alfrescoNtlm

#
# URL Generation Parameters (The ${localname} token is replaced by the local server name)
#-------------
#alfresco.context=alfresco
#alfresco.host=${localname}
#alfresco.port=8080
#alfresco.protocol=http
#
#share.context=share
#share.host=${localname}
#share.port=8080
#share.protocol=http

#imap.server.enabled=true
#imap.server.port=143
#imap.server.host=localhost

# Default value of alfresco.rmi.services.host is 0.0.0.0 which means 'listen on all adapters'.
# This allows connections to JMX both remotely and locally.
#
alfresco.rmi.services.host=0.0.0.0

#
# RMI service ports for the individual services.
# These seven services are available remotely.
#
# Assign individual ports for each service for best performance
# or run several services on the same port. You can even run everything on 50500 if needed.
#
# Select 0 to use a random unused port.
#
#avm.rmi.service.port=50501
#avmsync.rmi.service.port=50502
#attribute.rmi.service.port=50503
#authentication.rmi.service.port=50504
#repo.rmi.service.port=50505
#action.rmi.service.port=50506
#wcm-deployment-receiver.rmi.service.port=50507
#monitor.rmi.service.port=50508




Reboot the server


  Ø  sudo reboot now


It may take a while for alfresco to come up and set up the database the first time.  What I do is log back into the system them tail the tomcat log to see if alfresco is starting correctly, and for when it is done  (in my case it took 2 ½ minutes)


  Ø  sudo tail -f /opt/tomcat/logs/catalina.out






See the server startup message.

Adding New Users as Admin



Open up


















The default login is

User               = admin
Password     = admin


I always first change the admin password from the default just to make sure. To do this…

Click on User Profile





Click on Change password


























Enter new password and click Finish










 Click on  Manage System Users



Click Create New User


In my case I created a user called patman

























Click next  




















enter a password
Click Finish




Now add the user to the admin group.

Click on Administration Console
















Click on manage User Groups

  


















Click on Show all then click add user in the Alfresco_Adminstrators




Search for user, select user then click add.

















Finally click on OK


Now this user is an admin.



Log out and log back in as the user you just made and gave admin rights to.





Make sure this user can log into the Share site as well. 
Open up




















While you are in Alfresco share Create a folder to email into.

First create a site











Click on Sites àCreate Site























Call it Email_test and click OK



Making a folder in Alfresco e-mailable


Now that you have Alfresco 4.0e running, how do you get a folder
e-mailable?


SET UP AN INBOX USER


Once Alfresco is set up to receive emails directly if an email is received from an address that is associated with a current Alfresco user, it will be treated as if that user uploaded it.

As an example, if an email comes in from bob@example.com and we have a “bob” user in alfresco that has an email set as bob@example.com . Then when an email comes into our alfresco server from bob@example.com it will be treated as if “bob” uploaded it.   (of course this is assuming bob is set up as an email user and emailing into alfresco is turned on)


With that in mind, for this test, I will make a user to handle emails sent from non-alfresco users.  ( I will also make that user an admin user, which is not a good idea for a live system, because it could overwrite any file or folder)







OK so let’s make a new user.

Log into alfresco as an admin user







Click on  Manage System Users


Click Create New User































I gave it a user name of First name of email and last name of Anon.
I also gave it an email on email@example.com then clicked next






















I set its user name to emailAnon gave it a password and set its Home space to emailAnon and clicked next.



Click Finish



Now add the user to the email contributors and admin group.
















Click on Administration Console



Click on manage User Groups





Click on Show all then click add user in the EMAIL_CONTRIBUTORS





















By default user cannot email into the system.  In order for a user to be allowed to email into the system it must be part of the EMAIL_CONTRIBUTORS group.






















Type in email and click search.  This will display the emailAnon user.  select on this user and click add, it will then show up in the bottom part.  Finally click OK in the upper right.




Repeat the same thing for this user but for the ALFRESCO_ADMINISTRATORS group.   I did this so that they could upload to any folder.




















EDIT THE PROPERTIES FILE



Edit the alfresco-global.properties file again.


  Ø  cd /opt/tomcat/shared/classes
   Ø  sudo vi alfresco-global.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

# Email Server properties
#-------------
email.server.enabled=true
email.server.port=25
email.server.domain=ec2-72-44-49-158.compute-1.amazonaws.com
email.inbound.unknownUser=emailAnon
email.server.connections.max=3

email.server.enableTLS=false

# 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:
#-------------
email.server.allowed.senders=.*



Here is a line by line explanation (as best I can give)

email.inbound.enabled=true
            Just enable inbound email

email.server.enabled=true
email.server.port=25
email.server.domain=ec2-72-44-49-158.compute-1.amazonaws.com
            Turn on the alfresco email server bind it to port 25 and set the
            server domain name 

email.inbound.unknownUser=anonymous
            Any email from an unkown user will be uploaded as if it was
            uploaded by this alfresco user.
            A word of warning… Since the emailAnon user is an
            admin it means anyone can email into the system and overwrite  
           or add  anything (very dangerous so plan your system out better
           than this)

email.server.enableTLS=false
            For now shut this off it ist for TLS encryption when 
            sending/recieveing emails  In a real system you should
            probably turn this back on and configure it correctly
email.server.allowed.senders=.*
            A regex field that says what email addresses in are allowed.
            In this case any email would be allowed.

After this has been set up restart alfresco…

(in this case I just restarted tomcat to reboot alfresco)


 Ø  sudo /etc/init.d/tomcat restart


Watch it boot up again by tailing the log


 Ø  sudo tail -f /opt/tomcat/logs/catalina.out




Every file and folder has an email address in Alfresco.   But this email address is usually a number, which can be very hard to remember.  To solve this problem it’s possible to add an email alias to a folder or file.


Log into Alfresco as an admin user.

























Click on “Company Home”  Then Sites.  Here you will see the emailtest which is the share site you just created.

Click on emailtest.  



Now you can see the documentLibary folder.  Click on the View Details icon.





















The 844 is the email ID.  So to email into this folder you could email to 844@example.com and it would go into this folder.


But that is hard to remember so make an alias to make your life easier.




















Click on Run Action on the right hand side.
















Set to “add Aspect” and click “Set Values and add.



Select “Email Alias” and click OK


















Click Finish.














Now you will see this Email Alias added to your properties.













Click on Modify in the upper right.


Set the Email Alias to “inbox” and click OK














Now its Email Alias is set any email sent to inbox@ http://ec2-72-44-49-158.compute-1.amazonaws.com will go into this folder.


I opened up my yahoo email and sent this email



There is not attachment to this email.

Now go to share and login















Click on SitesàEmail_test









Click on the Document Library



Now you will see 2 files that were created from this one e-mail.

This is a test and this is a test.html


Now if you had sent it with a document attached say an excel file.




























Now you will see the xlsx file as an uploaded document.

No comments:

Post a Comment