Configuring Email With Apache James

Document created by inorton Employee on Jul 16, 2015
Version 1Show Document
  • View in full screen mode

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com

Email


Getting James Working With Alfresco


Overview


This page goes through instructions on how to configure Apache James with Alfresco for demos or other purposes. 

Apache James has a command-line utility.  All you really need to do is configure it to run on a specific port and create a user account for it.
James would be used for outbound mail.  This way you can POP3 into James to retrieve any emails.

For inbound, you configure the internal mail server.  Then you can setup the email client to use Alfresco for outbound.  That way you create a little closed-loop type of system.
For email, I suggest you pick up Thunderbird.




Basic Instructions for Setting it up with James as an Outbound Server:



  1. Download James Server

  2. On a windows box the default config is good, but on Linux or Mac, it's best to remap the ports.  Here the changes you should make to <JAMES_ROOT>\apps/james/SAR-INF/config.xml:

          <servernames autodetect='true' autodetectIP='true'>
               <servername>localhost</servername>
               <servername>example.com</servername>
          </servernames>


  3. Change <port> values on the following sections:
     
            <pop3server  enabled='true'>   <port>9110</port>
            <smtpserver enabled='true'>    <port>9025</port>
            <nntpserver enabled='true'>    <port>9119</port>


  4. Start James

    * SMTP is listening on port 9025
    * POP is listening on port 9110


  5. To create an account to be used by Alfresco:

          telnet to localhost port 4555
          login/pw: root/root
          adduser alfresco alfresco


  6. Now, you can set it up to route email to it from Alfresco.  Configure the server to respond to <user>@localhost and <user>@example.com.  example.com is a reserved domain name specifically for testing purposes... Edit custom-repository.properties thus:

         mail.host=localhost
         mail.port=9025
         mail.username=alfresco
         mail.password=alfresco
         mail.from.default=admin@example.com




See James Quickstart steps 11, 12 and 13 to send a quick email and to make sure it's received. 

  http://wiki.apache.org/james/JamesQuickstart

Now, you can configure your email client to point to James and send and receive emails through that account. 


  • Note: to send email to Alfresco, you'll have to add a user to the EMAIL_CONTRIBUTORS group.

Additionally, you'll need to send it to a space, so you'll need to both lookup the space email id, make sure that the user from whom you are sending this has access to that space and is a member of EMAIL_CONTRIBUTORS group.


For the inbound email, follow these instructions


Unzip custom-email-server.sample.zip from extensions directory and edit custom-email-server.properties

    email.inbound.enabled=true
    # The username to authenticate as when the sender address is not recognised
    #email.inbound.unknownUser=anonymous
   
    # Email Server properties
    email.server.enabled=true
    email.server.port=12525
    email.server.domain=alfresco.example.com
   
   
    # 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=.*

Finally, the last bit is that your SMTP configuration on the mail client should point to the Alfresco server and not James...  This allows you to SMTP to alfresco, and POP to James.


Using James to Relay Email to Alfresco Server


A more interesting setup would be to configure James to relay to the Alfresco server...  The idea would be that the email clients can be pointed to James for both SMTP (sending) and POP3 (receiving). It all goes through James, and James then routes the messages accordingly.

Line 590 in the config.xml

       <gateway> localhost </gateway>
       <gatewayPort>12525</gatewayPort>

That would route all non-local emails into the Alfresco SMTP.  Alfresco, in-turn will accept any emails bound for <id>@alf.example.com> assuming the sending user is in the 'authorized emailer' group...


Other Email Servers


The are other light-weight servers that people used for demo purposes. Both Argo and MailEnable have UIs that allow you to view email on the server, which is a nice feature.


Attachments

    Outcomes