send mail if there is at least one valid recipient
I have some code that sends emails using javax.mail.Transport
class.
Is there any way to send the message to valid addresses and ignore invalid ones?
This could be solved easily by putting a property in the properties like this
props.put("mail.smtp.sendpartial", "true");
This will tell java to send mail even if there are not valid reciepients
addresses that don't exist-specifically their domain doesn't exist
You could perform a java DNS lookup. That can help verify if the domain exists. But there is no way to know if a given address is valid or not, even if the server exists. If there were a way to do this, spam bots would have a field day :). A verified email address is a valuable asset to certain individuals.
精彩评论