AbstractMailNotifier<MailMessage> notifier = new DefaultMailNotifier<MailMessage>(mailSender);
notifier.setFrom("测试name<user1@localhost>");
DefaultNotificationTask<MailMessage> task = new DefaultNotificationTask<MailMessage>();
task.setNotifier(notifier);
MailMessage mmc = new MailMessage("测试", "测试简单邮件发送机制", "user2@localhost");
task.getMessageQueue().addMessage(mmc);
task.send();
MimeMessage[] msgs = greenMail.getReceivedMessages();
assertEquals(1, msgs.length);
}