开发者

find out whether an email was BCC'd to me - Blackberry

My Application requires me to find out whether an incoming email was BCC'd to me or am i the direct(to,cc) recipient.

I have used the SendListener and the Address class but i am still clueless how to get what i need.

Any lead woul开发者_运维知识库d be appreciated.

Thanks n Cheers


try this

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜