user = s.substring(0, s.indexOf('@'));
host = s.substring(s.indexOf('@')+1);
}
- public String coerceToString() { return toString(); }
public String toString() { return description.equals("") ? (user +"@"+ host) : description+" <" + user +"@"+ host + ">"; }
- public static class Malformed extends RuntimeException { public Malformed(String s) { super(s); } }
+ public String coerceToString() { return toString(); }
+ public static class Malformed extends Message.Malformed { public Malformed(String s) { super(s); } }
+
+ public boolean isLocal() {
+ InetAddress[] mx = SMTP.getMailExchangerIPs(host);
+ for(int i=0; i<mx.length; i++) {
+ try { if (NetworkInterface.getByInetAddress(mx[i]) != null) { return true; } }
+ catch (Exception e) { /* DELIBERATE */ }
+ }
+ Log.warn(this, "returning false");
+ return false;
+ }
}