hai,
it seems u forgot to have activation.jar in u'r classpath
- Original Message -
From: Antonio W. Lagnada <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 27, 2000 8:40 AM
Subject: JavaMail Help
> Hi All,
> Please help. I am getting this return code with my SendMail Program
> using the JavaMail 1.1.3 package.
>
> It seems to be complaining about a class not existing (the javamail is
> defined in my $CLASSPATH).
>
> The SendMail.java compiles with no errors. Are there properties that
> I am not setting here?
>
>
> Here's the 500 message:
>
> Error: 500
>
> Location: /my/servlet/SendMail
>
> Internal Servlet Error:
>
> java.lang.NoClassDefFoundError: javax/activation/DataHandler
> at javax.mail.internet.MimeBodyPart.setText(MimeBodyPart.java:753)
> at javax.mail.internet.MimeMessage.setText(MimeMessage.java:1146)
> at javax.mail.internet.MimeMessage.setText(MimeMessage.java:1134)
> at SendMail.doGet(SendMail.java:54)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
> at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:597)
> at
org.apache.tomcat.servlets.InvokerServlet.service(InvokerServlet.java:257)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
> at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:160)
> at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
)
> at java.lang.Thread.run(Thread.java:475)
>
>
>
> Here's the code:
>
> import javax.mail.*;
> import javax.mail.internet.*;
>
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> import java.io.*;
> import java.util.*;
>
> import lagnada.servlet.*;
>
> public class SendMail extends HttpServlet {
> private String smtpHost = "server2.lagnada.com";
>
> // Initialize the servlet with the hostname of the SMTP server
> // we'll be using to send the messages
>
> public void doGet(HttpServletRequest req, HttpServletResponse res)
> throws ServletException, IOException {
>
> PrintWriter out = res.getWriter();
>
> String from = "[EMAIL PROTECTED]";
> String to = "[EMAIL PROTECTED]";
> String subject = "This is a subject";
> String text = "This is the content of the email";
>
> String status = null;
>
> try {
> // Create the JavaMail session
> Properties properties = System.getProperties();
> properties.put("mail.smtp.host", smtpHost);
> Session session = Session.getInstance(properties, null);
>
> // Construct the message
> MimeMessage message = new MimeMessage(session);
>
> // Set the from address
> Address fromAddress = new InternetAddress(from);
> message.setFrom(fromAddress);
>
> // Parse and set the recipient address
> Address[] toAddress = InternetAddress.parse(to);
> message.setRecipients(Message.RecipientType.TO, toAddress);
> message.setSubject(subject);
> message.setText(text);
>
> Transport.send(message);
> status = "Your message was sent.";
>
> } catch (AddressException e) {
> status = "There was an error parsing the addresses.";
> } catch (SendFailedException e) {
> status = "There was an error sending the message.";
> } catch (MessagingException e) {
> status = "There was an unexpected error.";
> }
>
> Util u = new Util();
> res.setContentType("text/html");
> out.println(u.header("Send Mail"));
> out.println(u.startHtml("white"));
> out.println(u.h1("Send Mail") + "status: " + status + u.BR);
>
> out.close();
>
> }
>
>
>
> } // end class SendMail
>
>
>
>
> --
> Antonio W. Lagnada
> Ecommerce Consultant
> [EMAIL PROTECTED]
>
> This email address is specifically
> for JSP-Interest email list.
> Remove _NOSPAM for the actual email.
>
>
>
> ___
> To get your own FREE ZDNet Onebox - FREE voicemail, email, and fax,
> all in one place - sign up today at http://www.zdnetonebox.com
>
>
===
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be fou