I have a bundle that has a service that sends email using javamail library in ISO-2022-JP encoding and a servlet that invokes this service to send emails. The bundle has mail-1.4.1.jar dependency defined in pom.xml. When I am hitting the servlet URL, email is sent properly.
e.g. http://localhost:4502/bin/jpemailiso?to=TO_EMAIL&from=FROM_EMAIL&subject=437%E3%81%AA%E3%81%9F%E3%81...
when I hit this url, email is sent successfully.
But when I am trying to invoke the service directly in a form action POST.jsp, I am getting the following error:
javax.mail.NoSuchProviderException: smtp
at javax.mail.Session.getService(Session.java:794)
at javax.mail.Session.getTransport(Session.java:718)
at javax.mail.Session.getTransport(Session.java:661)
at javax.mail.Session.getTransport(Session.java:641)
at javax.mail.Session.getTransport(Session.java:696)
at javax.mail.Transport.send0(Transport.java:186)
at javax.mail.Transport.send(Transport.java:118)
Not sure why is this happening. What would be the difference in invoking the service from a servlet and POST.jsp. Please help me on this.