Hi Andrew,

since your problem is of interest to me I had some thoughts on it. But I
have to warn you, that I am not very into JAMES.

> This would need to be coupled with a match on Sender so that we can
> check if Sender == null && RemoteAddrNotInNetwork -> Error|Spam

If you do this check after local delivery (you want your users to receive
notification mails) like in the standard relaying configuration of JAMES
this seems to be what you wanted.
Since an OR is easier to implement (to AND matchers you need a single
processor for every condition) I would recommend a configuration like this:

<processor name="root">
....
<mailet match="All"
class="ToProcessor"><processor>relay</processor></mailet>
</processor>

<processor name="relay">
<mailet match="RecipientIsLocal"
class="ToProcessor"><processor>transport</processor></mailet>
<mailet match="HostIsLocal"
class="ToProcessor"><processor>error</processor></mailet>
<mailet match="NamedSender"
class="ToProcessor"><processor>transport</processor></mailet>
<mailet match="RemoteAddrInNetwork=10."
class="ToProcessor"><processor>transport</processor></mailet>
<mailet match="All" class="ToProcessor"><processor>spam</processor></mailet>
</processor>

The NamedSender Matcher would look like:
public class NamedSender extends GenericMatcher {
    public Collection match(Mail mail) {
        if (mail.getSender()!=null) {
            return mail.getRecipients();
        } else {
            return null;
        }
    }
}

To me the real problem seems to be that you want mails from your local
network to be relayed even if not authenticated. Which probably is a not too
uncommon desire. Afer a little of investigation it seems that you have to
run two instances of JAMES to accomplish this. You can run them easily in a
single VM if you modify the assembly.xml in the conf directory (at least it
should be easy). If you are not using a jdbc spool I suppose that you will
need another set of spool direcotries?
What I first tried to find was a way to have only two SMTPServer blocks
running (one using smtpauth and one not). Since there is no way for a
Matcher to know if a mails sender has been authenticated you would need two
processor configurations (really nice would be the feature that those could
pass mails from one to another and thus you could leave common configuration
in one of them and hereby lessen the number of mailet instances [since we
are using xml you always can restrain from doubling your configuration by
use of parsed entities]).
But the smtpserver block accesses the spool over the james block (roughly
speaking).
Maybe these comments were useful.

Cheers,
  Marcus

PS: oh yes. I forgot to mention. You need the two smtpserver to run on
different ports in any case. Which should be no problem since you have to
forward the port to the wan over a firewall anyway. (Extending the
SMTPHandler to investigate the ip of the sender seems not quite right, but
in conjuction with the ability of a Matcher to know whether the sender has
been authenticated would be a solution as well)













--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to