JavaMail api - javax.mail.NoSuchProviderException: smtp
Problem #
When you are using Java’s mailapi.jar, it also expects supporting libraries like smtp.jar, imap.jar, pop3.jar, gimap.jar, dsn.jar. If you are using Java EE platform, then it is already included. But if you are getting the following error, you might have to include additional libraries, from Java mail API.
|
|
There are several forums and discussions happening on this same issue. Surprisingly, this is a small class path issue.
Solution #
To solve this error, make sure you have both mailapi.jar and smtp.jar in your classpath. Also, make sure you don’t have duplicate jar files in your class path.
Reading the FAQ on Oracle’s documentation will give you a better idea. https://www.oracle.com/technetwork/java/javamail/faq/index.html
References #
- https://www.oracle.com/technetwork/java/javamail/javamail-138606.html
- https://www.coderanch.com/t/601387/java/java/smtp-error/
- https://stackoverflow.com/questions/2980408/problem-with-java-mail-no-provider-for-smtp/
- https://stackoverflow.com/questions/16861553/javax-mail-nosuchproviderexception-no-provider-for-smtps/
- https://answers.atlassian.com/questions/167299/unable-to-send-email-and-error-as-javax-mail-nosuchproviderexception/