我的应用程序要求我查明收到的电子邮件是BCC给我还是直接(收件人,cc)收件人。
我使用过SendListener和Address类,但我仍然无法得到我需要的东西。
任何领导都将不胜感激。
谢谢你干杯
答案 0 :(得分:0)
试试这个
public static String getMyEmailAddress() {
// Shared routine to get this BlackBerry's default email address
String emailAddress;
try {
Session ourSession = Session.getDefaultInstance();
// This returns null if BB does not have a Message Service - which means next
// instruction will get a null pointer exception.
emailAddress = ourSession.getServiceConfiguration().getEmailAddress();
} catch ( Exception e ) {
emailAddress = null;
}
return emailAddress;
}
public static boolean isBCCToME(){
String myEmailAddress =getMyEmailAddress();
Address[] a = msg.getRecipients(Message.RecipientType.BCC);
for (int i = 0; i < a.length; i++) {
if(a[i].equals(myEmailAddress)){
return true;
}
}
return false;
}