When a Received header is invalid, mail may be created with a null remote address and host name. Some mailets and matchers will throw a NullPointerException when processing the injected mail!
Future modifications may unwittingly cause the same problem.
The solution is to ensure that at the point where the mail is created the mail always has the remote address and host name set. The default values used when a null value is encountered are:
host name: localhost