I need to setup a James mail server to basically receive e-mail and
forward all mail to a "master" mail server. I've modified the
RemoteDelivery mailet properites within the transport processor of the
config.xml and specified the gateway server hostname and port. When I
test the James mail server by sending mail to it, I am getting the
following output in the logs:
17/04/07 14:10:51 INFO James.Mailet: RemoteDelivery: Unknown gateway
host: unknown host
17/04/07 14:10:51 INFO James.Mailet: RemoteDelivery: This could be a
DNS server error or configuration error.
I did an nslookup on my gateway server hostname and noticed that only an
MX record has been setup... no A record exists for this hostname. For
example:
mailout01 MX example.wellsfargo.com
The quick fix for this is to just use the hostname
"example.wellsfargo.com" rather than "mailout01.wellsfargo.com".
I dug into the RemoteDelivery mailet source to see what is going on...
RemoteDelivery.getGatewaySMTPHostAddresses(Collection) is grabbing each
gateway hostname and calling
org.apache.james.dnsserver.DNSServer.getAllByName(nextGateway);
DNSServer.getAllByName(nextGateway) is a wrapper method that makess a
call out to org.xbill.DNS.Address.getAllByName(allowIPLiteral(host));
org.xbill.DNS.Address.getAllByName(String addr) {
byte [] bytes;
bytes = toByteArray(addr, IPv4);
if (bytes != null)
return InetAddress.getByAddress(bytes);
bytes = toByteArray(addr, IPv6);
if (bytes != null)
return InetAddress.getByAddress(bytes);
throw new UnknownHostException("Invalid address: " + addr);
}
The UnknownHostException is thrown when executing
InetAddress.getByAddress(bytes) for my hostname
"mailout01.wellsfargo.com" because DNS cannot resolve it's A record.
For hostnames that have an A record, this exception is not thrown, which
then RemoteDelivery.getGatewaySMTPHostAddresses(Collection) formats the
returned InetAddress into a URL string like
"smtp://something.goes.here". I am guessing that specifying the
"SMTP://" indicates that port 25 will be accessed.
So it seems that the bug is in having InetAddress.getByAddress()
attempting to resolve the A record of the gateway server hostname. A
solution could be to lookup the MX record of the gateway server,
retrieve the A record that the MX record is pointing to and then call
org.xbill.DNS.Address.getAllByName(String addr).
Please advise.
Thanks,
Tim Michalski