I appreciate the feedback. I agree now that this isn't a bug. I did some digging into the SMTP RFC 2821 http://www.ietf.org/rfc/rfc2821.txt (sections 3.8 & 5) to see what they had to say about gateways and they didn't really specify a proper way of connecting to the gateway or that address resolution of the gateway needed to be the same when delivering mail directly to the destination SMTP server (section 5).
Although, from a purist perspective, wouldn't it make sense to handle communicating with the SMTP gateway in the same way as if delivering mail to the destination STMP server? Perhaps it makes sense to first do an MX lookup of the gateway address, and if no MX record is found, to then use the A record? I'm willing to code this change and submit it to the Apache James project if it makes sense. Please advise. Tim Michalski -----Original Message----- From: Stefano Bagnara [mailto:[EMAIL PROTECTED] Sent: Friday, April 20, 2007 9:09 AM To: James Users List Subject: Re: RemoteDelivery mailet doesn't do an MX lookup on the gateway smtp hostname(s) Hi Tim, If I understood your problem then it is not a bug. In the gateway you have to provide a valid hostname, with a valid "IN A" (direct) resolution. As you noticed mailout01 has not direct resolutions, but only an mx, so it is pretty useless as we couldn't know where to connect to. You probably have simply to use example.weelsfargo.com as your gateway. Stefano [EMAIL PROTECTED] ha scritto: > 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 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
