//设置收件人地址
InternetAddress[] address = {new InternetAddress([email protected]),
new InternetAddress([email protected]),...};
msg.setRecipients(Message.RecipientType.TO, address);
InternetAddress[] address = {new InternetAddress([email protected]),
new InternetAddress([email protected]),...};
msg.setRecipients(Message.RecipientType.TO, address);
InternetAddress[] address = {new InternetAddress([email protected]),
new InternetAddress([email protected]),...};
编译不过。
for (int i=0;i<to.length;i++)
setSendTo(to[i]);
}
void setSendTo(String to) throws Exception{
// System.out.println("sending mail to :"+to[i]);
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
}
this();
this.setSendTo(to);
this.setFrom(from);
this.setSubject(subject);
this.setBody(body);
}
public Sendmail(String[] to, String from, String subject, String body) throws Exception{
this();
this.setSendTo(to);
this.setFrom(from);
this.setSubject(subject);
this.setBody(body);
}