示例#1
0
  public void sendEmail() throws MessagingException {
    if (msg.getFrom() == null)
      msg.setFrom(new InternetAddress("*****@*****.**"));
    msg.setHeader("X-mailer", "msgsend");
    msg.setRecipients(Message.RecipientType.TO, (Address[]) toList.toArray(new Address[0]));
    msg.setRecipients(Message.RecipientType.CC, (Address[]) ccList.toArray(new Address[0]));
    msg.setRecipients(Message.RecipientType.BCC, (Address[]) bccList.toArray(new Address[0]));
    msg.setSentDate(new Date());

    if (!toList.isEmpty()) Transport.send(msg);
  }