引发的消息异常:javax.mail.internet.AddressException:非法分号,不在字符串的组中

时间:2017-11-01 05:24:52

标签: java email

在我的原始电子邮件内容中,我收到了这样的“收件人”地址字段,例如收件人:abc@gmail.com; efg@gmail.com; hij@gmail.com      当我尝试阅读此内容以在我的Java程序中使用此>>

message.getRecipients(RecipientType.TO)

我得到了以下异常

引发了消息异常:

javax.mail.internet.AddressException: Illegal semicolon, not in group in string ``abc@gmail.com;efg@gmail.com;hij@gmail.com'' at position 21
    at javax.mail.internet.InternetAddress.parse(InternetAddress.java:929)
    at `enter code here`javax.mail.internet.InternetAddress.parseHeader(InternetAddress.java:663)
    at javax.mail.internet.MimeMessage.getAddressHeader(MimeMessage.java:733)
    at javax.mail.internet.MimeMessage.getRecipients(MimeMessage.java:565)

1 个答案:

答案 0 :(得分:0)

      @Override
    public void onClick(View view) {
        mSort.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Collections.sort(mKickStarter, new Comparator<Kickstarter>() {
                    @Override
                    public int compare(Kickstarter item1, Kickstarter item2) {
                        return item1.getTitle().compareToIgnoreCase(item2.getTitle());

                    }
                });
            }
        });
       mAdapter.notifyDataSetChanged();
    }