Basic Doubts
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Rekha_Andrews
Posted On:   Wednesday, March 26, 2003 02:52 AM

This is my first lesson in java mail. I just want to send a mail from my application after the completion of a process. Execution of following sample code raising error String smtpHost = "smtp.mail.yahoo.com"; String popHost = "pop.mail.yahoo.com"; props.put("mail.smtp.host", smtpHost); // Get session Session session = Session.getDefaultInstance(props, null); session.setDebug(true); // Pop Authenticate yourself Store store = session.getStore("pop3"); store.connect(popHost, username, password); // Define message MimeMessage message = new MimeMessage(session);    More>>


This is my first lesson in java mail.
I just want to send a mail from my application after the completion of a process.
Execution of following sample code raising error

			
				
String smtpHost = "smtp.mail.yahoo.com";
String popHost = "pop.mail.yahoo.com";
props.put("mail.smtp.host", smtpHost);
// Get session
Session session = Session.getDefaultInstance(props, null);
session.setDebug(true);

// Pop Authenticate yourself
Store store = session.getStore("pop3");
store.connect(popHost, username, password);

// Define message
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 Yahoo's JavaMail");

// Send message
Transport.send(message);

Error raised is
DEBUG: setDebug: JavaMail version 1.3
DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Mi
POP3: connecting to host "pop.mail.yahoo.com", port 110
javax.mail.MessagingException: Connect failed;
nested exception is:
java.net.NoRouteToHostException: Operation timed out
at java.lang.Throwable. (Compiled Code)
at java.lang.Exception. (Compiled Code)
at javax.mail.MessagingException. (MessagingException.java:55)

Could some provide the reason and solution for this problem
Thanks in advance.    <<Less
About | Sitemap | Contact