【发布时间】:2011-08-05 19:15:15
【问题描述】:
嗨朋友们,我使用下面的代码发送邮件。 我在 JDE5.0 中使用 ESS 对其进行了测试,但它不起作用。 所以请给我一些解决方案。
导入 net.rim.blackberry.api.mail.; 导入 net.rim.blackberry.api.mail.event.; 导入 net.rim.device.api.system.*; 公共类 BasicMail 扩展应用程序 { 私人商店商店; 静态无效主要(字符串参数 []){ BasicMail app = new BasicMail("a"); app.enterEventDispatcher(); } 基本邮件(字符串 s) { //从默认邮件Session中获取Store。 Store store = Session.getDefaultInstance().getStore();
//检索发送的文件夹 文件夹[] 文件夹 = store.list(Folder.SENT); 文件夹 sentfolder = 文件夹[0];
//创建一条新消息并将其存储在已发送的文件夹中 消息消息 = 新消息(已发送文件夹); 地址收件人[] = 新地址[1];
试试{ 收件人[0]=新地址(“poovavin@gmail.com”,“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(me); } }
}
【问题讨论】: