紧急----javamail 邮件发送 设置多个收件地址 在线等待
Message.RecipientType.TO
Message.RecipientType.CC
Message.RecipientType.BCC
TO CC BCC
我每个里面最多只能设置三个收件人地址,
三个加起来也只能设置9个接收地址。
我假如要设置10个接收地址,就不知道怎么做了。
大侠们帮帮忙啊!江湖救急啊!
下面是代码:
Address[] toAddress = { new InternetAddress("aaa@everglow-ltd.com"),
new InternetAddress("bbb@ichiban.com.cn"),
new InternetAddress("ccc@ichiban.com.cn") };
Address[] ccAddress = { new InternetAddress("fefw@ichiban.com.cn"),
new InternetAddress("ddd@ichiban.com.cn"),
new InternetAddress("eee@everglow-ltd.com") };
Address[] bccAddress = { new InternetAddress("fff@everglow-ltd.com"),
new InternetAddress("ggg@everglow-ltd.com") };
mimeMessage.setRecipients(Message.RecipientType.TO, toAddress);
mimeMessage.setRecipients(Message.RecipientType.BCC, bccAddress);
mimeMessage.setRecipients(Message.RecipientType.CC, ccAddress);
mimeMessage.setFrom(new InternetAddress("nnn@everglow-ltd.com"));
------解决方案--------------------写个接收方法,再new InternetAddress("eamilAddress")
------解决方案--------------------如果你有MimeMessage msg = new MimeMessage(...); ,就可以用下面的方法设置收件人:
Java code
msg.addRecipients(javax.mail.Message.RecipientType.TO, InternetAddress.parse("...@ichiban.com.cn"));