Many thanks

Raymond, I'll make a note of that one.

> From [EMAIL PROTECTED] Thu Oct 22 17:40:15 1998
> Date: Thu, 22 Oct 1998 14:13:05 -0230
> From: Raymond Lambe <[EMAIL PROTECTED]>
> Mime-Version: 1.0
> To: "Nguyen, Tram N." <[EMAIL PROTECTED]>
> Cc: 'Matt Zagni' <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> Subject: Re: request for a sendmail java script
> Content-Transfer-Encoding: 7bit
> 
> Matt,
> 
> I would also sugest that you check out the O'Reilly book "Java Examples
> in a Nutshell". You can download all the examples for this book at:
> 
> http://www.oreilly.com/catalog/jenut/examples/
> 
> It includes a sendmail.java example almost identical to the one Tram has
> show here. If you like seeing example code on how things work, I'd
> suggest that you download these examples.
> 
> Ray
> 
> Nguyen, Tram N. wrote:
> > 
> > The following example is a very simple sendmail tool using 'mailto:'
> > protocol, you can write your own mail handler for smtp protocol or other
> > ultilizing net, io package .
> > 
> > import java.io.*;
> > import java.net.*;
> > 
> > /**
> >  * This program sends e-mail using a mailto: URL
> >  **/
> > public class SendMail {
> > 
> >     private String to, message;
> >     private String from, subject;
> >     final static String EmailServer = "company.com";
> > 
> >     private URL u;
> >     private URLConnection c;
> >     private PrintWriter out;
> > 
> >   public SendMail (String t, String m)
> >   {
> >    to = t;
> > 
> >    message = new String ("You mesage ");
> >    subject = new String ("Your subject");
> >    from = new String ("Sender name");
> > 
> >   }
> >   public int send(){
> >    int rtnStatus=0;
> >    try {
> >     System.getProperties().put("mail.host", EmailServer);
> >     u = new URL("mailto:" + to);
> >     c = u.openConnection();
> >     c.setDoInput(false);
> >     c.setDoOutput(true);
> >     System.out.flush();
> >     c.connect();
> >     out = new PrintWriter(new OutputStreamWriter(c.getOutputStream()));
> > 
> >     out.println ("From: \""  + from + "\" <");
> >     out.println ("To: " + to);
> >     out.println ("Subject: " + subject);
> >     out.println ();
> > 
> >     out.println (message);
> > 
> >     //out.close();
> >     //System.out.println("Message was sent");
> >     System.out.flush();
> >     rtnStatus = 1;  //if sucessful return 1
> >    }catch (Exception e)
> >    {
> >     System.err.println(e);
> >    }finally {out.close();return rtnStatus;}
> >   }
> > }
> > 
> > > -----Original Message-----
> > > From: Matt Zagni [SMTP:[EMAIL PROTECTED]]
> > > Sent: Thursday, October 22, 1998 3:45 AM
> > > To:   [EMAIL PROTECTED]
> > > Subject:      request for a sendmail java script
> > >
> > >
> > > Hi,
> > >
> > > Please could someone mail me an example of a sendmail java class file
> > > and .java file or even a url where examples are located.
> > >
> > > Many thanks
> > >
> > > Matt
> 

Reply via email to