amer2812 0 Newbie Poster

hey everybody i have question regarding JSP
i'm new to this language and it's required from me to send emails by jsp and i'm using dreamweaver for that
i worked and did the codes but still get errors:
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 20 in the jsp file: /SendMail.jsp
Authenticator cannot be resolved to a type
17: props.put("mail.debug", "true");
18: props.put ("mail.smtp.starttls.enable", "true");
19: props.put("mail.transport.protocol", "smtp");
20: Authenticator auth = new Authenticator() {
21: protected PasswordAuthentication getPasswordAuthentication(){
22: return new PasswordAuthentication("XXXXXX", "XXXXXX");
23: }


An error occurred at line: 20 in the jsp file: /SendMail.jsp
Authenticator cannot be resolved to a type
17: props.put("mail.debug", "true");
18: props.put ("mail.smtp.starttls.enable", "true");
19: props.put("mail.transport.protocol", "smtp");
20: Authenticator auth = new Authenticator() {
21: protected PasswordAuthentication getPasswordAuthentication(){
22: return new PasswordAuthentication("XXXXXXXX", "XXXXX");
23: }

================================================

The jsp page :

<%@ page import="java.util.*" %>
<%@ page import="javax.mail.*" %>
<%@ page import="javax.mail.internet.*" %>
<%@ page import="javax.activation.*" %>
  
<%

//  public static void main (String args[]) throws Exception { 
    String host = "XXXXXXXXX"; 
    String to = "XXXXXXXXXX"; 
    String from = "XXXXXXXXXX"; 
    Properties props = System.getProperties();
    props.put("mail.smtp.host", host); 
    props.put("mail.smtp.auth","true");
	props.put("mail.smtp.port", "25");
	props.put("mail.debug", "true");
	props.put ("mail.smtp.starttls.enable", "true");
 	props.put("mail.transport.protocol", "smtp");

	Session session = Session.getDefaultInstance(props, null); 
    session.setDebug(true); 
    MimeMessage message = new MimeMessage(session); 
    message.setFrom(new InternetAddress(from)); 
    message.addRecipient(Message.RecipientType.TO,  
      new InternetAddress(to));   
    message.setSubject("Hello JavaMail"); 
    message.setText("Welcome to JavaMail"); 
    // Send message 
    Transport.send(message); 
   
//}
%>