Feras Odeh
Feras Odeh

Reputation: 9306

send mail if there is at least one valid recipient

I have some code that sends emails using javax.mail.Transport class.
The code calls the send method, but if there is any invalid address the message won't be send.

Is there any way to send the message to valid addresses and ignore invalid ones?

Upvotes: 2

Views: 5169

Answers (2)

Feras Odeh
Feras Odeh

Reputation: 9306

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

Upvotes: 6

Deepak Bala
Deepak Bala

Reputation: 11185

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.

Upvotes: 1

Related Questions