tomcat-users mailing list archives

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

I found the solution.

I had import the wrong Session-class.

So long,
 Sebastian

> 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
> 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message