Hi,

Import JavaMail packages into your servlet app:

import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

and for SMTP connection put following properties into Session object:
...
  private Session session;
...
    Properties props = new Properties();
    props.put("mail.transport.protocol", "smtp");
    props.put("mail.smtp.host", smtp_host);

    props.put("mail.store.protocol", "imap4");
    props.put("mail.host","sampleMailServer");
    props.put("mail.user",user);
    props.put("mail.from",address);
...
     session = Session.getInstance(props, null);


Best regards,
Roman Zvyaguintsev
mailto:[EMAIL PROTECTED]


> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology. [mailto:[EMAIL PROTECTED]]On
> Behalf Of Peter Barraud
> Sent: Wednesday, September 05, 2001 3:48 PM
> To: [EMAIL PROTECTED]
> Subject: Tomcat/Apache - JavaMail
>
>
> Hi,
> I am using JavaMail on a windows machine with Apache as the web
> server. Does
> anybody know if I can use JavaMail to send mail via the servlets in the
> Tomcat on the server. Actually what would be the smtp host address if for
> example my server name is sampleMailServer.
> pb
>
> __________________________________________________________________
> _________
> 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

Reply via email to