English 中文(简体)
无法从BlackBerry发送电子邮件-JDE4.7
原标题:Unable to send email from BlackBerry - JDE4.7
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("someemail@email.com", "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("someemail@gmail.com", "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.");
问题回答

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

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

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

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





相关问题
add text in http request string url

ok i made a midlet through which i can connect to server pages and get soem information as response. For example i made a midlet through which i acced url: http://example.com/?u=nepal&t=1 Now i ...

Do I have to do a setSize() on a Vector before using it?

Given private final Vector v = new Vector(); //instance variable the following 3 lines are in an instance method in the same class. 1. int length = v.capacity(); 2. int size = v.size(); ...

Is the situation with Java ME improving?

It seems to be the consensus that developing for Java ME is not as cross platform as you might expect, particularly compared to say java SE, but it is difficult to assess how the situation is evolving....

Privileged operations in netbeans mobility

I m writing a Java ME app that will use privileged operations such as messaging. By default the user is prompted to confirm each of these operations, but I would like to run it as a background ...

ClassFormatError: 56 while using hessian in j2me

I am trying to use the hessian j2me implementation @ http://hessian.caucho.com/ using java me sdk 3.0. http://hessian.caucho.com/doc/hessian-overview.xtp#Hessian%20Client%20for%20a%20cell-phone ...

热门标签