mailtest.java
来自「Rapla是一个灵活的多用户资源管理系统。它提供的一些功能有:日历GUI」· Java 代码 · 共 30 行
JAVA
30 行
package org.rapla.components.mail;
import junit.framework.TestCase;
import org.apache.avalon.framework.logger.ConsoleLogger;
public class MailTest extends TestCase
{
public void testMailSend() throws MailException
{
SmtpClient client = new SmtpClient();
client.setSmtpHost("localhost");
client.setSmtpPort( 5023);
client.enableLogging( new ConsoleLogger( ConsoleLogger.LEVEL_DEBUG));
MockMailServer mailServer = new MockMailServer();
mailServer.setPort( 5023);
mailServer.startMailer( true);
String sender = "zimt@gmx.de";
String recipient = "zimt@gmx.de";
client.sendMail(sender,recipient,"HALLO", "Test body");
assertEquals( sender.trim().toLowerCase(), mailServer.getSenderMail().trim().toLowerCase());
assertEquals( recipient.trim().toLowerCase(), mailServer.getRecipient().trim().toLowerCase());
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?