Open lgrapenthin opened 9 years ago
I took a look at this and it's hard to fix without also addressing :joy::joy: what I think is a design mistake in swallowing address exceptions during message creation. We could throw some other exception instead of an NPE, but "the message had address errors, sorry" isn't much more helpful than the NPE.
What do people think about a breaking change to fix address handling? Worth fixing in 1.x, or wait for a 2.x? I'd like to modernize other parts of the code as well, so leaning toward a 2.x. I'll document other improvements I see as possibilities and if anyone wants to submit PRs, that would be great. :pray:
I'd be very happy with some sort of InvalidAddressException instead of an NPE.
In smtp-send*, the return value of .getAllRecipients should be checked for null. Please refer to http://docs.oracle.com/javaee/5/api/javax/mail/Message.html#getAllRecipients()
Otherwise .sendMessage comes up with a weird null pointer exception if null is passed as addresses parameter, which happens if no receiver can be parsed.