Sometimes when we use JavaMail API to send email and got some error like below
Problem :
Use JavaMail API to send Email via GMail smtp server, but hit the following error message :
Solution :
To solve it, you need to include the mail.jar as well, which you can get it from your JavaEE SDK folder or JavaMail API official page.
Again, to send Email via JavaMail API, you need to include both javaee.jar and mail.jar libraries
Problem :
Use JavaMail API to send Email via GMail smtp server, but hit the following error message :
Caused by: java.lang.ClassNotFoundException: com.sun.mail.util.MessageRemovedIOExceptionThe javaee.jar library is included.
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 1 more
Solution :
To solve it, you need to include the mail.jar as well, which you can get it from your JavaEE SDK folder or JavaMail API official page.
Again, to send Email via JavaMail API, you need to include both javaee.jar and mail.jar libraries