JavaMail api - javax.mail.NoSuchProviderException: smtp
Contents
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. http://www.oracle.com/technetwork/java/javamail/faq/index.html
References
- http://www.oracle.com/technetwork/java/javamail/javamail-138606.html
- http://www.coderanch.com/t/601387/java/java/smtp-error/
- http://stackoverflow.com/questions/2980408/problem-with-java-mail-no-provider-for-smtp/
- http://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/
Author: Deepu Mohan Puthrote
Link: https://deepumohan.com/tech/javamail-javax-mail-no-such-provider-exception/
This work by Deepu Mohan Puthrote is licensed under a Creative Commons Attribution 4.0 International License