james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Noel J. Bergman" <n...@devtech.com>
Subject Mailet API and Getting Relays from Message
Date Sun, 09 Jun 2002 01:11:04 GMT
Does anyone have a better regex than

  (from|FROM)
.*[\\(\\[]([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})[\\]\\)]

for stripping the IP address from a Received header?

Basically, I've code that does:

   String[] relays = message.getHeader("Received");

   for (int i = 0; i < relays.length; i++)
     if (matcher.contains(relays[i], pattern))
     {
        String ip = matcher.getMatch().group(2));
        ...
     }

It works with all of the headers I have come across so far, but I'm just
checking.

Since I already have several matchers that want this information, I'm
thinking of making this a utility method, e.g.,

	public String[] getRelays(MimeMessage);

Alternatively, a natural place to hang this would be on
org.apache.mailet.Mail as

	public String[] getRelays();

but I am not going to change that interface without agreement!

	--- Noel


--
To unsubscribe, e-mail:   <mailto:james-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:james-dev-help@jakarta.apache.org>


Mime
View raw message