Java Mail
Hi all I just tried to do the Java Mail tutorial but can not get it working. Here is my code:
import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.event.*;
import javax.mail.internet.*;
import javax.activation.*;
publicclass BasicJavaMail{
publicstaticvoid main(String args[]){
//Strings
String text =new String("text");
String subject =new String("subject");
String fromAdd =new String("scotthendo@gmail.com");
String toAdd =new String("scotthendo@hotmail.com");
String ccAdd =new String();
String fromName =new String("Scott");
String mailhost =null;
try
{
Properties props =new Properties();
props.put("mail.smtp.host", mailhost);
Session sess = Session.getDefaultInstance(props,null);
MimeMessage mess =new MimeMessage(sess);
mess.setText(text);
mess.setSubject(subject);
Address fromAddress =new InternetAddress(fromAdd, fromName);
mess.setFrom(fromAddress);
Address toAddress =new InternetAddress(toAdd);
Address ccAddress =new InternetAddress(ccAdd);
mess.addRecipient(Message.RecipientType.TO, toAddress);
mess.addRecipient(Message.RecipientType.CC, ccAddress);
mess.saveChanges();// implicit with send()
Transport transport = sess.getTransport("smtp");
transport.connect(host, username, password);
transport.sendMessage(mess, mess.getAllRecipients());
transport.close();
sess.setDebug(true);
}
catch (Exception e){}
}
}
It compiles and runs but I dont recieve the email, I have unblocked Java from my firewall so thats not the problem.
Thankyou in advance for any help
Scott.

