无法从 BlackBerry 发送电子邮件 - JDE4.7

发布于 2024-09-26 17:33:08 字数 1455 浏览 5 评论 0原文

Store store = Session.getDefaultInstance().getStore();
Folder[] folders = store.list(Folder.SENT);
Folder sentfolder = folders[0];
// Create message.
Message msg = new Message(sentfolder);
// Add TO Recipients.
Address toList[] = new Address[1];
try {
toList[0]= new Address("[email protected]", "Some Email");
} catch(AddressException e) {
System.out.println(e.toString());
}
try {
msg.addRecipients(Message.RecipientType.TO, toList);
} catch (MessagingException e) {
System.out.println(e.toString());


}
// Add CC Recipients.
Address ccList[] = new Address[1];
try {
ccList[0]= new Address("[email protected]", "some address");
} catch(AddressException e) {
System.out.println(e.toString());
}
try {
msg.addRecipients(Message.RecipientType.CC, ccList);
} catch (MessagingException e) {
System.out.println(e.toString());
}
// Add the subject.
msg.setSubject("A Test Email");
// Add the message body.
try {
msg.setContent("This is a test message.");
} catch(MessagingException e) {
// Handle messaging exceptions.
}
// Send the message.
try {
Transport.send(msg);
} catch(MessagingException e) {
System.out.println(e.getMessage());
}
System.out.println("Email sent successfully.");
Store store = Session.getDefaultInstance().getStore();
Folder[] folders = store.list(Folder.SENT);
Folder sentfolder = folders[0];
// Create message.
Message msg = new Message(sentfolder);
// Add TO Recipients.
Address toList[] = new Address[1];
try {
toList[0]= new Address("[email protected]", "Some Email");
} catch(AddressException e) {
System.out.println(e.toString());
}
try {
msg.addRecipients(Message.RecipientType.TO, toList);
} catch (MessagingException e) {
System.out.println(e.toString());


}
// Add CC Recipients.
Address ccList[] = new Address[1];
try {
ccList[0]= new Address("[email protected]", "some address");
} catch(AddressException e) {
System.out.println(e.toString());
}
try {
msg.addRecipients(Message.RecipientType.CC, ccList);
} catch (MessagingException e) {
System.out.println(e.toString());
}
// Add the subject.
msg.setSubject("A Test Email");
// Add the message body.
try {
msg.setContent("This is a test message.");
} catch(MessagingException e) {
// Handle messaging exceptions.
}
// Send the message.
try {
Transport.send(msg);
} catch(MessagingException e) {
System.out.println(e.getMessage());
}
System.out.println("Email sent successfully.");

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最近可好 2024-10-03 17:33:08

你在模拟器上运行这个吗?如果是,哪种开发环境(eclipse 或 JDE)?您是否已开始使用 MDS 还是正在使用 ESS? (使用 MDS 4,您不需要 ESS。)

就个人而言,我将 eclipse 与插件一起使用,然后设置运行时配置来启动 MDS。

但是,在此之前,您需要编辑 rimpublic.property 文件以将其配置为连接到您的电子邮件服务器(如果您使用的是远程电子邮件服务器)。如果您要使用本地邮件客户端,请将 MDS 配置为将其用作传递。

让我知道您的设置/配置是什么,我会尽力提供更多帮助。

Are you running this on a simulator? If so, which development environment (eclipse or JDE)? Have you started the MDS or are you using ESS? (With MDS 4, you don't need ESS.)

Personally, I use eclipse with the plug-in, then set the run-time configuration to launch MDS.

However, before doing that, you need to edit the rimpublic.property file to configure it to connect to your e-mail server (if you are using a remote e-mail server). If you are going to use a local mail client, configure MDS to use that as a pass-through.

Let me know what your setup / configuration is and I'll try to help more.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文