开发者

send mail if there is at least one valid recipient

I have some code that sends emails using javax.mail.Transport class.

Th开发者_运维技巧e 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜