2010-08-21 83 views
0

嗨,朋友我使用下面的代碼發送郵件。 我使用ESS在JDE5.0中測試它不起作用。 所以請給我一些解決方案。如何在黑莓eclipse插件中測試發送電子郵件1.1

import net.rim.blackberry.api.mail。 ; import net.rim.blackberry.api.mail.event。; import net.rim.device.api.system。*; 公共類BasicMail擴展應用程序{0}私有商店商店; static void main(String args []){ BasicMail app = new BasicMail(「a」); app.enterEventDispatcher(); } BasicMail(String s) { //從默認郵件會話中獲取存儲。 Store store = Session.getDefaultInstance()。getStore();

//檢索發送的文件夾 Folder [] folders = store.list(Folder.SENT); 文件夾sentfolder =文件夾[0];

//創建一條新消息並將其存儲在發送的文件夾中 消息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); 

} 趕上(例外我){ 通信System.err.println(箱); }}

}

回答