Hello:
Please, would somebody know how to configure the J2EE Server (in Windows NT
Server 4.0) for sending mail from a servlet that uses the JavaMail API ?
I have executed successfully a Java application which sends messages using
the JavaMail API. For that, I placed the JavaMail jar's (mail.jar,
pop3.jar, activation.jar) in the jre/lib/ext directory.
But, I didn't have success when I execute a servlet which sends messages
with JavaMail (additionally, I placed the JavaMail jar's in
j2sdkee1.2\lib\system directory and in the servlet directory).
The problem is about "javax.mail.NoSuchProviderException: No provider
for smtp" : the J2EE server doesn't find any provider for smtp.
The exception message reported in the J2EE log is the following:
-----------------------------------------------------------------
javax.mail.NoSuchProviderException: No provider for smtp
at javax.mail.Session.getProvider(Session.java:249)
at javax.mail.Session.getTransport(Session.java:442)
at javax.mail.Session.getTransport(Session.java:423)
at TechSupport2.sendMail(TechSupport2.java:181)
at TechSupport2.doPost(TechSupport2.java:42)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:775)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:868)
at
org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper
.java:621)
at
org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper
.java:529)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.ja
va:373)
at org.apache.tomcat.core.Context.handleRequest(Context.java:648)
at
org.apache.tomcat.server.ConnectionHandler.run(ConnectionHandler.java
:205)
-----------------------------------------------------------------------
The piece of code charged of sending the message in the servlet is the
following:
--------------------------------------------------------------
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
try{
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("[EMAIL PROTECTED]"));
InternetAddress[] address = {new InternetAddress("[EMAIL PROTECTED]")};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject("some subject");
msg.setSentDate(new Date());
msg.setText("this is the message");
Transport transport = session.getTransport("smtp"); // the exception
occurs here
transport.send(msg);
}
catch (Exception e) {
e.printStackTrace();
}
------------------------------------------------------------
Thanks you for any suggestion about this problem.
Maria Consuelo Franky
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
Maria Consuelo FRANKY R. [EMAIL PROTECTED]
CincoSOFT Ltda. http://cincosoft.tripod.com
Compa�ia de Ingenieros Constructores de Software
Carrera 15 # 80-48 (Ofc. 402) Tel: (1)6230180, 6226350
Apartado Aereo 350.762 Fax: (1)2566774
Bogota * COLOMBIA Celular: (033)3504483
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html