views:

36

answers:

0

Hi friends I usedthe code below for sending mail. I tested it in JDE5.0 with ESS it doesnt work. So please give me some solution.

import net.rim.blackberry.api.mail.; import net.rim.blackberry.api.mail.event.; import net.rim.device.api.system.*; public class BasicMail extends Application { private Store store; static void main (String args[]) { BasicMail app = new BasicMail("a"); app.enterEventDispatcher(); } BasicMail(String s) { //Get the Store from the default mail Session. Store store = Session.getDefaultInstance().getStore();

//retrieve the sent folder Folder[] folders = store.list(Folder.SENT); Folder sentfolder = folders[0];

//create a new message and store it in the sent folder Message msg = new Message(sentfolder); Address recipients[] = new Address[1];

try { recipients[0]= new Address("[email protected]", "poovannan");

  //add the recipient list to the message
  msg.addRecipients(Message.RecipientType.TO, recipients);

  //set a subject for the message
  msg.setSubject("Test email");

  //sets the body of the message
  msg.setContent("This is a test email from my BlackBerry Wireless Handheld");

  //sets priority
  msg.setPriority(Message.Priority.HIGH);

  //send the message
  Transport.send(msg);

} catch (Exception me) { System.err.println(me); } }

}