----- Original Message -----
From: Manoj Mansukhani <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 07, 1999 3:14 AM
Subject: Re: Email from servlet.


> hi
>
> i have written the following code using the Java Mail API which allows one
> to send email using a servlet.
> you will require the following two files
> 1.  mail.jar - available with the Java Mail API
> 2.  activation.jar - available with Java Activation Framework
>
> this is the code :
>
> import java.util.*;
> import javax.mail.*;
> import javax.mail.internet.*;
> import javax.activation.*;
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
>
> public class Formmail extends HttpServlet {
>
>         public void doGet(HttpServletRequest req, HttpServletResponse res)
> throws ServletException, IOException {
>                 res.setContentType("text/html");
>                 PrintWriter out = res.getWriter();
>
>                 out.println("<HTML><HEAD></HEAD>");
>                 out.println("<BODY>Email has been sent</BODY></HTML>");
>
>                 boolean debug = false; // change to get more infomation
>
>                 //  set the host
>                 Properties props = new Properties();
>                 props.put("mail.smtp.host", "192.168.0.15");
>
>                 // create some properties and get the default Session
>                 Session session = Session.getDefaultInstance(props, null);
>                 session.setDebug(debug);
>
>
>                 try {
>                         // create a message
>                         Message msg = new MimeMessage(session);
>
>                         // set the from
>                         InternetAddress from = new
> InternetAddress("[EMAIL PROTECTED]");
>                         msg.setFrom(from);
>
>                         InternetAddress[] address = {new
> InternetAddress("[EMAIL PROTECTED]")};
>                         msg.setRecipients(Message.RecipientType.TO,
> address);
>                         msg.setSubject("test message");
>
>                         String msgText;
>                         msgText = "this is a test message";
>                         msg.setContent(msgText, "text/plain");
>
>                         Transport.send(msg);
>
>
>
>
>                 } catch (MessagingException mex) {
>                                 mex.printStackTrace();
>                 }
>
>
>         }
>
> }
>
>
Hi,

using JavaMail 1.1.x you can no longer create a mail
Session.getDefaultInstance with an Authenticator of null. This
is a bloody pain in the proverbial, anyone had similar experiences with this
and solved it?

Andy Bailey

___________________________________________________________________________
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

Reply via email to