- 论坛徽章:
- 0
|
关于邮件群发
Properties props = new Properties();
props.put("mail.smtp.host", emailHost_);
Session session = Session.getDefaultInstance(props, null);
session.setDebug(true);
int i = 0;
//emailTo_是一个邮件地址的字符串的Collection
for(Iterator it = emailTo_.iterator(); it.hasNext(); )
{
address = new InternetAddress((String)it.next());
i++;
}
// create a message
Message msg = new MimeMessage(session);
InternetAddress address[] = new InternetAddress[emailTo_.size()];
msg.setRecipients(Message.RecipientType.TO, address); |
|