📄 mailtest.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -