代码之家  ›  专栏  ›  技术社区  ›  Umesh

找出邮件是否是密件传给我的-黑莓

  •  0
  • Umesh  · 技术社区  · 15 年前

    我的申请要求我查明收到的电子邮件是密件抄送给我的,还是我是直接(收件人,抄送)收件人。

    我已经使用了SendListener和Address类,但是我仍然不知道如何获得所需的内容。

    任何线索都将不胜感激。

    谢谢,干杯

    1 回复  |  直到 15 年前
        1
  •  0
  •   Vivart    15 年前

    试试这个

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