import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.io.*;
public class T
{
public static void main(
String[] args)
{
Properties props = new Properties();
props.put("mail.smtp.host", "mail.cloud9.net");
//props.put("mail.host", "SMTP.mail.yahoo.com");
//props.put("mail.host", "smtp.blabla.co.om");
try
{
Session mailConnection = Session.getInstance(props, null);
Address bill = new InternetAddress("jig2nesh@yahoo.com",true);
Address elliotte = new InternetAddress("jig2nesh@yahoo.com",true);
System.out.println(elliotte);
Message msg = new MimeMessage(mailConnection);
msg.setFrom(bill);
msg.setRecipient(Message.RecipientType.BCC, elliotte);
msg.setSubject("You must comply.");
msg.setContent("Resistance is futile. You will be assimilated!",
"text/plain");
Transport.send(msg);
}
catch(AddressException a)
{
}
catch (SendFailedException e)
{
//e.printStackTrace();
//System.out.println((e.getInvalidAddresses()).length);
System.out.println(e);
}
catch (MessagingException e)
{
}
}
}
we get invalid address and relay Access Denied Exception....
Please Help Us...
Jignesh