Hey!
But be aware of the risk of using "sun.net.smtp.SmtpClient" class. See the
archive for much discussion on this topic.
Sans adieu,
Danny Rubis
Geeta Ramani wrote:
> We use sun.net.smtp.SmtpClient. It's very easy to use..
> Geeta
>
> "Srini Sathya." wrote:
>
> > in addition to the javamail api u must download the javax activation
> > framework api also, as DataHandler and someother classes are imported from
> >
> > javax.activation.*
> >
> > Cheers
> > Srini
> > -----Original Message-----
> > From: William Kennon, Jr. Allen [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, August 03, 2000 6:19 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: I need to send an e-mail from my servlet
> >
> > try to use the javax mail API at
> > http://java.sun.com/j2ee/j2sdkee/techdocs/api/index.html
> >
> > try{
> > String host = "mail.perspex.com";
> > String from = "[EMAIL PROTECTED]";
> > String to = "[EMAIL PROTECTED]";
> > String messageText= "Status Report Enclosed";
> >
> > Properties props = System.getProperties();
> > props.put("mail.smtp.host", host);
> > Session Mailsession = Session.getInstance(props, null);
> >
> > MimeMessage message = new MimeMessage(Mailsession);
> > MimeBodyPart mbp1 = new MimeBodyPart();
> > MimeBodyPart mbp2 = new MimeBodyPart();
> > mbp1.setText(messageText);
> > FileDataSource fds = new FileDataSource("javamailtest.txt");//path is
> > relative to JVM
> > mbp2.setDataHandler(new DataHandler(fds));
> > mbp2.setFileName("javamailtest.txt");
> > message.setFrom(new InternetAddress(from));
> > message.addRecipient(Message.RecipientType.TO,
> > new InternetAddress(to));
> > message.setSubject("JavaMail with attachments");
> > Multipart mp = new MimeMultipart();
> > mp.addBodyPart(mbp1);
> > mp.addBodyPart(mbp2);
> > message.setContent(mp);
> >
> > Transport.send(message);
> > }catch(Exception e){
> > out.println(e);
> > }
> > }
> >
> > -----Original Message-----
> > From: Mauricio Nu�ez [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, August 03, 2000 10:06 AM
> > To: [EMAIL PROTECTED]
> > Subject: I need to send an e-mail from my servlet
> >
> > Hi everyone,
> >
> > I need to send an e-mail from my servlet. Where can i find a library or jar
> > or a class?
> > Sorry if my question is trivial.
> >
> > Thanks,
> >
> > Mauricio
> >
> > ___________________________________________________________________________
> > 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
> >
> > ___________________________________________________________________________
> > 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
> >
> > ___________________________________________________________________________
> > 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
>
> ___________________________________________________________________________
> 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
___________________________________________________________________________
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