How to send a yahoo mail id from javamail

This is my sample pgm,when i run this pgm,

i got an exception ,

nested exception is:

javax.mail.SendFailedException: 554 <xyz@yahoo.co.in>: Relay access denied.

Can u give me the suggestion.

package com;

import java.util.*;

import javax.mail.*;

import javax.mail.internet.*;

import javax.activation.*;

// Send a simple, single part, text/plain e-mail

publicclass TestEmail{

publicstaticvoid main(String[] args){

// SUBSTITUTE YOUR EMAIL ADDRESSES HERE!!!

String to ="xyz@yahoo.co.in";

String from ="xyz@mysmtpserver.com";

// SUBSTITUTE YOUR ISP'S MAIL SERVER HERE!!!

String host="smtp.mail.yahoo.com";

// Create properties, get Session

Properties props =new Properties();

// If using static Transport.send(),

// need to specify which host to send it to

props.put("mail.smtp.host", host);

props.put("mail.smtp.port","495");

// To see what is going on behind the scene

props.put("mail.debug","true");

Session session = Session.getInstance(props);

try{

// Instantiatee a message

Message msg =new MimeMessage(session);

//Set message attributes

msg.setFrom(new InternetAddress(from));

InternetAddress[] address ={new InternetAddress(to)};

msg.setRecipients(Message.RecipientType.TO, address);

msg.setSubject("Test E-Mail through Java");

msg.setSentDate(new Date());

// Set message content

msg.setText("This is a test of sending a " +

"plain text e-mail through Java.\n" +

"Here is line 2.");

//Send the message

Transport.send(msg);

System.out.println("msg");

}

catch (MessagingException mex){

// Prints all nested (chained) exceptions as well

mex.printStackTrace();

}

}

}

[3410 byte] By [SARAV_RSa] at [2007-11-27 5:58:53]
# 1
The answer is in the JavaMail FAQ.
bshannona at 2007-7-12 16:34:31 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...