mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
add method for #1335
This commit is contained in:
parent
b8e5cc006e
commit
648ba17107
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
### 新特性
|
### 新特性
|
||||||
* 【core 】 手机号工具类 座机正则表达式统一管理(pr#243@Gitee)
|
* 【core 】 手机号工具类 座机正则表达式统一管理(pr#243@Gitee)
|
||||||
|
* 【extra 】 Mail增加setDebugOutput方法(issue#1335@Gitee)
|
||||||
|
|
||||||
### Bug修复
|
### Bug修复
|
||||||
* 【core 】 修复ZipUtil.unzip从流解压关闭问题(issue#I2B0S1@Gitee)
|
* 【core 】 修复ZipUtil.unzip从流解压关闭问题(issue#I2B0S1@Gitee)
|
||||||
|
@ -25,6 +25,7 @@ import javax.mail.util.ByteArrayDataSource;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.PrintStream;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@ -77,6 +78,11 @@ public class Mail {
|
|||||||
*/
|
*/
|
||||||
private boolean useGlobalSession = false;
|
private boolean useGlobalSession = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* debug输出位置,可以自定义debug日志
|
||||||
|
*/
|
||||||
|
private PrintStream debugOutput;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建邮件客户端
|
* 创建邮件客户端
|
||||||
*
|
*
|
||||||
@ -345,6 +351,18 @@ public class Mail {
|
|||||||
this.useGlobalSession = isUseGlobalSession;
|
this.useGlobalSession = isUseGlobalSession;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置debug输出位置,可以自定义debug日志
|
||||||
|
*
|
||||||
|
* @param debugOutput debug输出位置
|
||||||
|
* @return this
|
||||||
|
* @since 5.5.6
|
||||||
|
*/
|
||||||
|
public Mail setDebugOutput(PrintStream debugOutput) {
|
||||||
|
this.debugOutput = debugOutput;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
// --------------------------------------------------------------- Getters and Setters end
|
// --------------------------------------------------------------- Getters and Setters end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -453,8 +471,14 @@ public class Mail {
|
|||||||
authenticator = new UserPassAuthenticator(mailAccount.getUser(), mailAccount.getPass());
|
authenticator = new UserPassAuthenticator(mailAccount.getUser(), mailAccount.getPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
return isSingleton ? Session.getDefaultInstance(mailAccount.getSmtpProps(), authenticator) //
|
final Session session = isSingleton ? Session.getDefaultInstance(mailAccount.getSmtpProps(), authenticator) //
|
||||||
: Session.getInstance(mailAccount.getSmtpProps(), authenticator);
|
: Session.getInstance(mailAccount.getSmtpProps(), authenticator);
|
||||||
|
|
||||||
|
if(null != this.debugOutput){
|
||||||
|
session.setDebugOut(debugOutput);
|
||||||
|
}
|
||||||
|
|
||||||
|
return session;
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------- Private method end
|
// --------------------------------------------------------------- Private method end
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user