GreeMail是一组主要用来做测试用的邮件服务器,支持SMTP、POP3、IMAP等,可以用来嵌入到任何的Java程序中。
示例代码
publicvoidtestYourSedigCode()throwsExceptio{GreeMailgreeMail=ewGreeMail();//usestestportsbydefaultgreeMail.start();GreeMailUtil.sedTextEmailTest("to@localhost.com","from@localhost.com","subject","body");//replacethiswithyoursedcodeassertEquals("body",GreeMailUtil.getBody(greeMail.getReceivedMessages()[0]));greeMail.stop();//That'sit!}
评论