if ((a = m.getRecipients(Message.RecipientType.CC)) != null) {
    for (int j = 0; j < a.length; j++) {

    InternetAddress ia = (InternetAddress)a[j];
    if (ia.isGroup()) {
        InternetAddress[] aa = ia.getGroup(false);
        for (int k = 0; k < aa.length; k++) {
                    cc.append(aa[k].getAddress()).append("; ");
                }
    }
            else
            {
                cc.append(ia.getAddress()).append("; ");
            }

    }
}

Hello I use Javamail to get CC adresses, but when I invoke getRecipients() from message object i got null. With recipient type TO it works. I get mail from Gmail, and on 100 percent message have CC adresses. It was a bug? Maybe I do it wrong.

有帮助吗?

解决方案

JavaMail returns what the server tells it. Turn on the protocol trace to see what the server is returning to JavaMail. The Cc information will be in the ENVELOPE response from the IMAP server.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top