tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Schneider, Sebastian" <se.schnei...@sap.com>
Subject Problem with JNDI Resources "JavaMail Sessions"
Date Thu, 02 Oct 2008 13:06:38 GMT
Hey Team,

I have some problems with the example of JNDI Resources "JavaMail
Sessions".

I get the error: The constructor MimeMessage(Session) is undefined

A extract from the HOW-TO page:
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Session session = (Session) envCtx.lookup("mail/Session");

Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(request.getParameter("from"));
InternetAddress to[] = new InternetAddress[1];
to[0] = new InternetAddress(request.getParameter("to"));
message.setRecipients(Message.RecipientType.TO, to);
message.setSubject(request.getParameter("subject"));
message.setContent(request.getParameter("content"), "text/plain");
Transport.send(message);

I develop with Eclipse / Tomcat 6.0 and created a new Web Application.

At first I modify my web descriptor (/WebContent/WEB-INF/web.xml) and
include the resource description.

In the next step I downloaded the JavaMail API, included to the
Tomcat-Library and configure the resource factory
(Tomcat/lib/context.xml).

Eclipse find the JavaMail API but it doesn't find the constructor in
this API.

I hope you can help me. This is a new section for me.

Best regards,
 Sebastian

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message