开发者

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

开发者 https://www.devze.com 2023-01-15 01:39 出处:网络
My Application requiresme to find out whether an incoming email was BCC\'d to me or am i the direct(to,cc)recipient.

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

精彩评论

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

关注公众号