hi friendz,
I am using
Java Mail API to send mail on my mail server but facing some problems. I kept extracted mail.jar and activation.jar files in classes directry of my application. Code generating the error is given below:
------------------------------------------------------------------------------------------
<%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*"%>
<%
try{
Properties props = new Properties();
props.put("mail.smtp.host", "mail.yahoo.com");
Session s = Session.getDefaultInstance(props,null);
InternetAddress from = new InternetAddress("
[email protected]");
InternetAddress to = new InternetAddress("
[email protected]");
MimeMessage message = new MimeMessage(s);
message.setFrom(from);
message.addRecipient(Message.RecipientType.TO, to);
message.setSubject("My subject");
message.setText("My Text");
Transport.send(message);
}
catch(Exception e){
out.println(e.getMessage());
e.printStackTrace();
}
%>
-----------------------------------------------------------------------------------------
ERROR:
------------------------------------------------------------------------------------------
Could not connect to SMTP host: mail.yahoo.com, port: 25
------------------------------------------------------------------------------------------
I am using Apache
Tomcat 5.5 to deploy and to run my application.
Please guide me for my mistake and all the necessary steps to follow to send text/formatted(Tabular Format) mail.
Thanks in advance