java - Is there a safe way to differentiate types of SendFailedExceptions from JavaMail -


i getting sendfailedexception because sendmail instance has email addresses blacklisted (to filter out emails non-developers during testing). sendfailedexception indicate failure connect smtp server or else. when exception occurs because email blacklisted, need ignore message , continue, other exception should allowed propagate out of method. when @ javamail api, appears sendfailedexception lowest level of exception can (the last 1 in javax.mail package). need is underlying smtpsendfailedexception, in com.sun.mail package, and, far understand, means implementation specific , should not used. however, class has getreturncode() method used differentiate between sendfailedexceptions. there better way this? safe use com.sun.mail classes? suggestions?

you can use com.sun.mail classes described in javadocs. unlike standard javax.mail classes, try hard keep stable , compatible, there's small chance com.sun.mail classes evolve incompatibly in future releases. understand many people use these classes, not make such changes lightly, if necessary improve javamail implementation or support new standard api classes, might change.

note there lots of com.sun.mail classes not described in javadocs. use of higher risk; they're more change incompatibly in minor releases.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -