James setup

Bakelite installation

Move content of lib directory from Bakelite mailet archive bakelite-X-mailet.tar.gz,zip to $james.home/apps/james/lib.

You can also get our James bundle including Bakelite mailet. In this case, you will still need to read next configuration section. Using bundle, take care to have a look at section in config.xml marked with xml comment ? check.bakelite.

Configuration

Edit $james.home/apps/james/SAR-INF/config.xml, with $james.home is place where james is installed.

Ensure you have properly set server names in this file. You should also add server names starting with fax you want to use as fax suffix.

  <servernames autodetect="true" autodetectIP="true">
    <servername>myserver</servername>
    [...]
    <servername>faxn</servername>
 </servernames>

With preceding example, fax can be sent with @faxn suffix.

Add org.bakelite.fax as mailet package, excepted you have get James-Bakelite bundle :

   <mailetpackages>
     <mailetpackage>org.apache.james.transport.mailets</mailetpackage>
     <mailetpackage>org.apache.james.transport.mailets.smime</mailetpackage>
     [...]
     <mailetpackage>org.bakelite.fax</mailetpackage>
   </mailetpackages>

Configure PDFFaxMailet, adjusting parameters :

  <mailet match="RecipientIsRegex=(.*)@fax(.*)" class="PDFFaxMailet">
    <managerHost>localhost</managerHost>
    <managerUser>mngruser</managerUser>
    <managerPassword>mngrpass</managerPassword>
    <channelFormat>mISDN/g:te_ptmp_1/{0}/!e:vt0</channelFormat>
    <caller>NOZICAA</caller>
    <context>nozicaa</context>
    <logPath>/var/log/txfax.log</logPath>
    <locale>fr</locale>
  </mailet>
managerHost
Asterisk manager host (see manager.conf file in you Asterisk configuration)
managerUser
User to connect to Asterisk manager (see manager.conf file in you Asterisk configuration)
managerPassword
Password for Asterisk manager user (see manager.conf file in you Asterisk configuration)
channelFormat
Format for outgoing channel, with 0 substituted at runtime with fax number
caller
Fax caller name
logPath
Path to txfax log (usually /var/log/txlog.log)
locale
Locale used for Bakelite messages (see 2 letters code from http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes}ISO 639-1)

Relay

If you want to use this set up James as your single outgoing (SMTP) server, you will first have to allow non local (non 127.0.0.1) addresses by edit James config.xml.

Adjust RemoteAddrNotInNetwork mailet to have something like :

  <mailet match="RemoteAddrNotInNetwork=127.0.0.1, 192.168.0.*, 192.168.1.*" class="ToProcessor">
    <processor> relay-denied </processor>
    <notice>550 - Requested action not taken: relaying denied</notice>
  </mailet>

You will have also to comment <authorizedAddresses /> in SMTP server configuration not to have conflit with previous relay control.

From there you have the choice. You can let James resolve MX for external addresses (for addresses it doesn't manage itself) using DNS and then relay mail directly to retrieved MX servers. For exemple sending email to adrs@extdomain.com, James can get mail.extdomain.com as MX server from DNS managing extdomain.com and so email goes directly from your James to mail.extdomain.com. This solution is great if your James runs under a server name that can be resolved by external DNS. Indeed, to respect standard more and more mail server will require you to make your own mail server resolvable, to be sure you are not faking mail stuff for spam purpose. So if your James can be externally resolved all is ok, and you will be fully independent (of ISP).

If your James runs on a internal server, and so cannot be externally resolved, you can configure its remote delivery to use a friend public (resolvable) server as gateway. This public server must trust your James. Then this public server will process remote delivery (working with other external mail servers) whereas internal mail address and fax can be managed by James. To do that you have to comment out gateway lines in RemoteDelivery section of James config.xml. You should have something like :

  <gateway>mail.mydomain.fr</gateway>
  <gatewayPort>25</gatewayPort>

Cleanup

Finally, you will need to re-pack $james.home/apps/james directory as $james.home/apps/james.sar archive file with jar utility (coming with JDK/JRE).

# cd ${james.home}/apps/james
# jar -cvf ../james.sar META-INF/MANIFEST.MF .

Test

To test your brand new James server, you can go to bin subdirectory and use run.sh script. This will require you to define JAVA_HOME environment variable.

# export JAVA_HOME="/my/java/home/dir"
# cd ${james.home}/bin
# ./run.sh

If you don't see any error at this step, your setup should be ok and so you can start working with it.

Trying to run James on default SMTP/POP3 ports (25, 110) on Unix platform should cause java.net.BindException: Permission denied if logged user is not root (as these ports are reserved, < 1024).

Launch at startup

In order to launch James at startup you will need to add a script in start system used by you platform (launchd on Mac OS X, init script on Linux).

As sample, you can find an init script for Gentoo Linux distro in sources under src/gentoo/config directory.