mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add customProperty
This commit is contained in:
@@ -2,6 +2,7 @@ package cn.hutool.extra.mail;
|
||||
|
||||
import com.sun.mail.util.MailSSLSocketFactory;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.security.GeneralSecurityException;
|
||||
@@ -22,14 +23,15 @@ public class MailAccountTest {
|
||||
Assert.assertTrue(account.isSslEnable());
|
||||
}
|
||||
|
||||
/*
|
||||
测试案例:使用QQ邮箱、AOL邮箱,如果不改SocketFactory实例,会报错(unable to find valid certification path to requested target),
|
||||
hutool mail中仅提供了'mail.smtp.socketFactory.class'属性,但是没提供'mail.smtp.ssl.socketFactory'属性
|
||||
参见 com.sun.mail.util.SocketFetcher.getSocket(java.lang.String, int, java.util.Properties, java.lang.String, boolean)
|
||||
|
||||
已经测试通过
|
||||
/**
|
||||
* 测试案例:使用QQ邮箱、AOL邮箱,如果不改SocketFactory实例,会报错(unable to find valid certification path to requested target),
|
||||
* hutool mail中仅提供了'mail.smtp.socketFactory.class'属性,但是没提供'mail.smtp.ssl.socketFactory'属性
|
||||
* 参见 com.sun.mail.util.SocketFetcher.getSocket(java.lang.String, int, java.util.Properties, java.lang.String, boolean)
|
||||
* <p>
|
||||
* 已经测试通过
|
||||
*/
|
||||
@Test
|
||||
@Ignore
|
||||
public void customPropertyTest() throws GeneralSecurityException {
|
||||
MailAccount mailAccount = new MailAccount();
|
||||
mailAccount.setFrom("xxx@xxx.com");
|
||||
|
@@ -1,36 +1,35 @@
|
||||
package cn.hutool.extra.mail;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
|
||||
/**
|
||||
* 邮件发送测试
|
||||
* @author looly
|
||||
*
|
||||
*/
|
||||
public class MailTest {
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void sendWithFileTest() {
|
||||
MailUtil.send("hutool@foxmail.com", "测试", "<h1>邮件来自Hutool测试</h1>", true, FileUtil.file("d:/测试附件文本.txt"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void sendWithLongNameFileTest() {
|
||||
//附件名长度大于60时的测试
|
||||
MailUtil.send("hutool@foxmail.com", "测试", "<h1>邮件来自Hutool测试</h1>", true, FileUtil.file("d:/6-LongLong一阶段平台建设周报2018.3.12-3.16.xlsx"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void sendWithImageTest() {
|
||||
@@ -38,13 +37,13 @@ public class MailTest {
|
||||
map.put("testImage", FileUtil.getInputStream("f:/test/me.png"));
|
||||
MailUtil.sendHtml("hutool@foxmail.com", "测试", "<h1>邮件来自Hutool测试</h1><img src=\"cid:testImage\" />", map);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void sendHtmlTest() {
|
||||
MailUtil.send("hutool@foxmail.com", "测试", "<h1>邮件来自Hutool测试</h1>", true);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void sendByAccountTest() {
|
||||
@@ -55,9 +54,9 @@ public class MailTest {
|
||||
account.setFrom("hutool@yeah.net");
|
||||
account.setUser("hutool");
|
||||
account.setPass("q1w2e3");
|
||||
MailUtil.send(account, "914104645@qq.com", "测试", "<h1>邮件来自Hutool测试</h1>", true);
|
||||
MailUtil.send(account, "hutool@foxmail.com", "测试", "<h1>邮件来自Hutool测试</h1>", true);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void mailAccountTest() {
|
||||
MailAccount account = new MailAccount();
|
||||
|
Reference in New Issue
Block a user