GreenMail 是一组主要用来做测试用的邮件服务器,支持 SMTP、POP3、IMAP 等,可以用来嵌入到任何的 Java 程序中。
示例代码
public void testYourSendingCode() throws Exception { GreenMail greenMail = new GreenMail(); //uses test ports by default greenMail.start(); GreenMailUtil.sendTextEmailTest("to@localhost.com", "from@localhost.com", "subject", "body"); //replace this with your send code assertEquals("body", GreenMailUtil.getBody(greenMail.getReceivedMessages()[0])); greenMail.stop(); //That's it! }GreenMail 是一组主要用来做测试用的邮件服务器,支持 SMTP、POP3、IMAP 等,可以用来嵌入到任何的 Java 程序中。
示例代码
public void testYourSendingCode() throws Exception { GreenMail greenMail = new GreenMail(); //uses test ports by default greenMail.start(); GreenMailUtil.sendTextEmailTest("to@localhost.com", "from@localhost.com", "subject", "body"); //replace this with your send codeGreenMail下载地址: http://www.icegreen.com/greenmail/download.html
开发参考文档:
系统环境及开发平台:跨平台, Java >>>进入GreenMail开源软件官方主页
No comments:
Post a Comment