I get a SendFailedException: 550 Invalid Address even when i set the "mail.smtp.from" property. How can I tell it to ignore invalid addresses and send to the rest?
SendFailedExceptionAPI documentation is explicit about your problem:
"The exception includes those addresses to which the message could not be sent as well as the valid addresses to which the message was sent and valid addresses to which the message was not sent."
This implies that the message will be send to any valid address and the
SendFailedException will allow you to figure out the valid (which got the message) and the invalid addresses.
Also, look at the property mail.smtp.sendpartial : "If set to true, and a message has some valid and some invalid addresses, send the message anyway, reporting the partial failure with a SendFailedException. If set to false (the default), the message is not sent to any of the recipients if there is an invalid recipient address. "
If that too fails, check your server setup.
You can also catch SendFailedException, and re-send to the addresses returned by sfe.getValidUnsentAddresses() .