下了JDavMail的包,测试没有起来,里面的build.xml应该怎么放置?还是实际测试无须build.xml
以下是官方测试代码
public class TestReceive {
public static void main(String[] args) {
try {
Properties prop = new Properties();
Session ses = Session.getInstance(prop);
Store store = new JDAVMailStore(ses, null);
store.connect(null, "your_hotmail_account", "your_hotmail_password");
if (store.isConnected()) {
Folder inbox = store.getFolder("INBOX");
if (inbox.exists()) {
inbox.open(Folder.READ_ONLY);
int nCount = inbox.getMessageCount();
System.out.println("Inbox contains " + nCount + " messages");

// Get the last message in the Inbox
MimeMessage msg = (MimeMessage)inbox.getMessage(nCount);
System.out.println("Subject : " + msg.getSubject());
System.out.println("From : " + msg.getFrom()[0].toString());
System.out.println("Content type : " + msg.getContentType());

System.out.println(msg.getContent());
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}It is now possible to send messages as well:public class TestSend {
public static void main(String[] args) {
try {
Properties prop = new Properties();
// Set the default enveloppe sender address
prop.setProperty("mail.davmail.from", "[email protected]");
Session ses = Session.getInstance(prop); // Create the transport connection
Transport transport = ses.getTransport("davmail_xmit");
transport.connect(null, "your_hotmail_account", "your_hotmail_password");
 
  // Prepare the message
MimeMessage txMsg = new MimeMessage(ses);
txMsg.setSubject("Test subject");

InternetAddress addrFrom = new InternetAddress("[email protected]");
txMsg.setFrom(addrFrom);

InternetAddress addrTo = new InternetAddress("your_recipient's_address", "your_recipient's_name");
txMsg.addRecipient(Message.RecipientType.TO, addrTo);

txMsg.setText("Hello world !");
txMsg.setSentDate(new Date());

// Send the message
  transport.sendMessage(txMsg, txMsg.getAllRecipients());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
错误信息:
javax.mail.MessagingException: protocolConnect exception;
  nested exception is: 
org.jdom.input.JDOMParseException: Error on line -1: Premature end of file.
at com.posisoft.jdavmail.JDAVMailService.protocolConnect(JDAVMailService.java:179)
at com.posisoft.jdavmail.JDAVMailStore.protocolConnect(JDAVMailStore.java:73)
at javax.mail.Service.connect(Service.java:234)
at javax.mail.Service.connect(Service.java:135)
at com.hzsh.cms.emailreceive.TestReceive.main(TestReceive.java:20)
何解?