i tried this coding,,
<%@page import ="java.sql.*" %>
<%@ page import="java.io.*,java.util.*,javax.mail.*"%>
<%@ page import="javax.mail.internet.*,javax.activation.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%
String host ="smtp.live.com";
String from ="my hotmail email id";
String to ="receiver mail id";
Properties props = System.getProperties();
props.put("mail.smtp.host", host);
Session msession = Session.getDefaultInstance(props, null);
MimeMessage message = new MimeMessage(msession);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO,
new InternetAddress(to));
message.setSubject("Hello JavaMail");
message.setText("Welcome to JavaMail");
Transport.send(message);
%>
But i got error as shown below..
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: javax.mail.AuthenticationFailedException: failed to connect, no password specified?
root cause
javax.mail.AuthenticationFailedException: failed to connect, no password specified?
note The full stack traces of the exception and its root causes are available in the GlassFish v3 logs.