I earlier had code that handled gmail's failed delivery status by checking
msg.getHeader("X-Failed-Recipients")[0]
But this code fails with other email providers like Yahoo, who don't use this Header, to list delivery failures.
Is there a general way, by which I could fail if delivery to an email Address failed or not ?
You're not going to get the answer out of DeliveryStatus.toString(). The information you're looking for is in the per-recipient delivery status notification information for the first recipient. Use getRecipientDSN(0), which returns an InternetHeaders object. Look in that for the header "Diagnostic-Code".
See the javadocs for the com.sun.mail.dsn.DeliveryStatus class for details.