找出一封电子邮件是否是BCC给我的 - 黑莓

时间:2010-09-02 13:32:41

标签: blackberry

我的应用程序要求我查明收到的电子邮件是BCC给我还是直接(收件人,cc)收件人。

我使用过SendListener和Address类,但我仍然无法得到我需要的东西。

任何领导都将不胜感激。

谢谢你干杯

1 个答案:

答案 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;
  }