U can use a file properties like the example sending by Saumont Pierre.
My example work fine in a java application, for servlet the way indicate by
Pierre will be fine.
Regards
Rinaldo

-----Messaggio originale-----
Da: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]Per conto di roy
woods
Inviato: giovedi 22 marzo 2001 20.07
A: [EMAIL PROTECTED]
Oggetto: Re: R: sending email from html form? how


--- RBonazzo <[EMAIL PROTECTED]> wrote:
> try this way:
>     SpedisciPosta(){
>         try{
>             Properties properties = new
> Properties();
>
> properties.put("mail.smtp.host",ServerP);
>             properties.put("mail.from",IndPosta);
>             Session session =
> Session.getInstance(properties, null);
>             Message message = new
> MimeMessage(session);
>             InternetAddress[] address = {new
> InternetAddress("[EMAIL PROTECTED]")};
>
> message.setRecipients(Message.RecipientType.TO,
> address);
>             message.setFrom(new
> InternetAddress(IndPosta));
>             message.setSubject("subject
> decription");// Insert subject
>
> message.setContent("content,"text/html");// insert
> content here
> I've insert html type but can also use "text/plain
>             Transport.send(message,address);
>         }catch(Exception e) {
>             System.out.println(e.toString());
>         }
>     }
>
> Regards
> Rinaldo Bonazzo
> Resp.IT Sardinia Point


Do I really need to create an object of Session type?
I mean can I skip this line:
Session session = Session.getInstance(properties,
null);

The mail is to be sent from a servlet.

roy-


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/

___________________________________________________________________________
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