The Jakarta Project James - Java Apache Mail Enterprise Server




Current Documentation

Older Documentation


Jakarta Information (web)

Related Projects (web)

This FAQ

This is a living document that provides answers to common questions about James, installation, configuration, admin and running not already answered in the documentation. Last Updated August 2002.


Would you please teach me how to set up a mailing list

James currently (v2.1) includes only the most basic list functionality, users can subscribe and unsubscribe, but there is no moderation of messages or subscriptions

To enable a list you need the following in config.xml in the root processor block and above the final mailet block -

<mailet match="CommandForListserv=james@localhost"

that will intercept the command emails sent to

  • james-on@localhost to subscribe the sender
  • james-off@localhost to unsubscribe the sender


<mailet match="RecipientIs=james@localhost" class="AvalonListserv">
    <membersonly> false </membersonly>
    <attachmentsallowed> true </attachmentsallowed>
    <replytolist> true </replytolist>

Which will distribute the mail to the current subscribers

in addition to the above you need to have a repository configured in the users-store block(usually near the bottom of config.xml) like so (database)-

<repository name="list-james"

Database users will also need to ensure that they have configured a data-source named to match the destination URL

Using the filesystem:-

<repository name="list-james"
    <destination URL="file://var/lists/list-james/"/>

Restart James, send a mail to james-on@localhost and you should be subscribed.

The repository, be it a database table or directory in the filesystem will be created automatically.

Database users can manipulate the users repository using SQL, and hence any application capable of running SQL queries against it.

James seems to be an open relay for Spam, is it?

In some simple tests of mail relays James appears to be an open relay, properly configured it is not.

Because James is an email application platform it currently accepts all mail delivered to it via SMTP for processing. Only after the mail has been recieved does this processing begin.

This means that James accepts Spam. However the default configuration, and any sensible re-configuration has a number of anti-spam measures which will prevent the re-transmisson of spam from James. This makes it a blackhole for spam.

This also means that James will not verify addresses, but of course this means that valid addresses can't be harvested from James by spammers either.

I can send messages to James, but nobody is receiving them. What do I do?

Check that you've added valid DNS servers to your James installation. Email delivery requires the use of special mail related DNS information (MX records), so James needs to explicitly be given DNS servers. Look at your config.xml file for a <dnsserver> section and add one or more DNS servers.

Additionally, check the RemoteAddrNotInNetwork matcher under<processor name="transport">. By default it looks like this:

<mailet match="RemoteAddrNotInNetwork=" class="ToProcessor">
    <processor> spam </processor>

because most mail programs will use the external IP address (as opposed to when processing mail, you need to add your internal network and/or your static IP address to this list. You may also use a DNS domain name in this list. The resulting entry would look something like this:

<mailet match="RemoteAddrNotInNetwork=,192.168.1.*"
    <processor> spam </processor>

This tells the processor that anything not in this address list should go to the spam processor.

Please note that if you wish to configure James to allow users to send email from any domain or IP address you will need to disable this matcher. In this situation you must use SMTP AUTH to ensure that your server does not act as an open relay. For more on open relays, please see the Open Relay Database.

I can send people messages via James, but nobody can send me messages. What do I do?

You need to do one of two things:

  1. Update your domain's DNS entries so there are MX records that point to the machine that is running James. Note that it is illegal for MX records to point to IP addresses. You need to point MX records to a valid CNAME or A name entry, and then map that eventually to an IP address.
  2. You could alternatively give people an email address with IP addresses. Most people will think it's a very strange email address, but hello@[] is a valid email address. Note that you need to wrap the IP address in brackets.

I'm trying to debug messages that James is trying to deliver. Where should I look?

First step is to look in the log directory at the mailet.log file. Look for entries that include the text "RemoteDelivery". This should provide some high-level debug information of James' attempt to delivery mail remotely.

If you want to delve into the code, look at the RemoteDelivery mailet. You may also want to review the mail repository source code for the repository type you are using (file, db, etc...).

What about IMAP support?

IMAP development had been stalled, but has recently attracted new activity. IMAP support is scheduled for inclusion in James v3. In the meantime, there is experimental code in the repository. If you are interested in working on or trying the IMAP prototype code, join the james-dev mailing list and let us know.

What about support virtual hosting?

James v2.1 includes a new mailet for database users, JDBCVirtualUserTable, that mimics some of the sendmail capabilities of the same name.

JDBCVirtualUserTable does not provide any administation tools. You'll have to create and maintain the database table yourself. The standard configuration is as follows:

CREATE TABLE VirtualUserTable
 user varchar(64) NOT NULL default '',
 domain varchar(255) NOT NULL default '',
 target_address varchar(255) NOT NULL default '',
 PRIMARY KEY (user,domain)

The standard query used with VirtualUserTable is:

select VirtualUserTable.target_address from VirtualUserTable, VirtualUserTable as VUTDomains
where (VirtualUserTable.user like ? or VirtualUserTable.user like "\%")
and (VirtualUserTable.domain like ?
or (VirtualUserTable.domain like "\%" and VUTDomains.domain like ?))
order by concat(VirtualUserTable.user,'@',VirtualUserTable.domain) desc limit 1

For a given [user, domain, domain] used with the query, this will match as follows (in precedence order):

  1. user@domain - explicit mapping for user@domain
  2. user@% - catchall mapping for user anywhere
  3. %@domain - catchall mapping for anyone at domain
  4. null - no valid mapping

A sample mailet looks like:

<mailet match="All" class="JDBCVirtualUserTable">

More generalized viirtual hosting is something the developers are still discussing. One issue is that POP3 does not support virtual hosting in that it does not have a command to indicate what domain the user is in. What this means is the mail server needs to support a 'mapping' or 'translation' convention, e.g., '' gets a username 'domaina.user1'. This allows the mail server to have a single username namespace. We have seen a few good proposals put forward, but nothing that seemed the clear solution, as ideally we could have this part solve the next issue.

Beyond that, James needs to refine virtual hosting for mailet processing. With the current user model, the mailet API has a Mail.getUser() method that no longer would be useable as a reliable indicator of whether they were in the local username namespace. To date we are unclear of the best way to bring this translation into the mailet processing. Similarly, it would be nice to support different mailet processing based on the domain, although this is somewhat feasible using the limited processing flow offered with a HostIs matcher.

Virtual hosting is one of the most requested features, and additional work is scheduled for the 3.0 release.

Where do I stick classes and jars?

We are largely reliant on what Avalon is doing in terms of classloading, but here are a few tips and suggestions:

  • Stick jars in the james/lib directory and add them to the classpath in run.bat or
  • Instructions for including classes for custom mailets and matchers can be found here and here respectively..
Eventually we hope to support mailet reloading and a special lib and classes directory within the james directory that custom mailets can load from, but for now these are hopefully some useful tips.

How do I upgrade to a newer version of James?

  1. Rename the previous james directory into a james.old
  2. Run phoenix to let the new james.sar be deployed.
  3. Copy config.xml from james.old to the new deployed james/conf directory
  4. Replace the var directory by the previous var directory. This will copy over user accounts, inboxes, spools, and whatever else.
  5. Restart James.

How do I run James as an NT/2k/XP service?

The version of Avalon Phoenix distributed with James v2.1 and later includes a wrapper that lets you run James as a service. An alternative strategy is to install the JavaService from Alexandia Software.

Why isn't my mailet making changes to a MimeMessage?

Check the JavaMail docs. Per the API, when you call MimeMessage.setContent(blah), you have to call saveChanges() to apply your changes. James tries to automatically call this method so you don't have to, but in certain cases you'll still have to call saveChanges().

How to remove unneeded services like NNTP, POP3?

The following information is based on James 2.0a3, but the upcoming 2.1 version should be similar.

NNTP and other underlying services are called "blocks" in the Avalon Phoenix terminology. Blocks are specified in the assembly.xml file which is located in the apps/james/SAR-INF directory (2.1) or apps/james/conf directory (2.0a3). Note: this file is created during the first startup of James.

There are dependencies between the blocks, which you can read from the file. For example the SMTP Server block depends on the users-store block, so if you want SMTP then you cannot remove the users-store block even if you only want to relay messages.

To remove the NNTP Server comment out the following blocks: NNTP server, NNTP Authentication Service, NNTP repository. To remove the POP3 Server comment out the POP3 Server block.

If you remove a block it wont't be loaded next time you restart James. You must also remove all sections related to the removed blocks from the James configuration file - config.xml - otherwise you will get error messages, saying that there is no corresponding block.

How can I contribute to James

Read the "Contributors How To" here

How can I make sendmail route local mail (or all mail) through James on the same machine?

Read the "sendmail How To" here

I am using Microsoft's SQL Type 4 JDBC Driver, why do I get a "Can't start manual transaction mode because there are cloned connections" exception?

I am using Microsoft's SQL Type 4 JDBC Driver, why do I get the following exception?
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Can't start manual transaction mode because there are cloned connections.

This seems to be a problem with the Microsoft Type 4 JDBC Driver and concurrent statements/transactions/resultsets on the same database conntection.

To solve this you need to add ;SelectMethod=cursor to the end of your dburl string. Your dburl string would then look something like this

NOTE: some people have complained about performance when using this option, the alternative is a 3rd party JDBC driver but these are often not free.

I am using James with a MySQL database and I keep getting a "Packet is larger than max_allowed_packet" when receiving large messages despite the fact that my max packet size is configured to be larger than my max message size. What's going on?

When a user tries to send a large message that is close to but not quite at the max message limit the send fails and an exception similar to the following appears in the log:

Sent: 451 Error processing message:
Exception spooling message: Exception caught while storing mail Container:
java.lang.IllegalArgumentException: Packet is larger than max_allowed_packet
from server configuration of 4193280 bytes;
nested exception is:
java.lang.RuntimeException: Exception caught while storing mail
Container: java.lang.IllegalArgumentException: Packet is larger than
max_allowed_packet from server configuration of 4193280 bytes

Because of how the JDBC driver is written, a 25% factor is necessary between the maximum message size and the max_packet_size to prevent the driver from throwing an exception. So if you want a 4MB maximum message size, you need a 5MB max_packet size. Or a 4MB max_packet_size allows only a 3.2MB max message.

Copyright © 1999-2002, Apache Software Foundation