我需要在我的邮件消息中添加多个抄送地址,但我不断收到以下异常:
javax.mail.internet.AddressException: Illegal Address (email@email.com;email@email.com,15)
这是我的代码:
final String ccAddress = (String) inputMessageHeaders.get(MailHeaders.CC);
final String[] arrayOfCCAddress = ccAddress.split(";");
for(String cc : arrayOfCCAddress) {
InternetAddress address = new InternetAddress(cc);
mimeMessageHelper.setCc(address);
}
ccAddress 的原始值为“email@email.com;email@email.com” 实际地址有效。为什么会抛出异常并将“,15”添加到CC地址的末尾?
谢谢