mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add method
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package cn.hutool.extra.mail;
|
||||
|
||||
import cn.hutool.core.builder.Builder;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.IORuntimeException;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
@@ -34,7 +35,7 @@ import java.util.Date;
|
||||
* @author looly
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public class Mail {
|
||||
public class Mail implements Builder<MimeMessage> {
|
||||
|
||||
/**
|
||||
* 邮箱帐户信息以及一些客户端配置信息
|
||||
@@ -364,6 +365,15 @@ public class Mail {
|
||||
}
|
||||
// --------------------------------------------------------------- Getters and Setters end
|
||||
|
||||
@Override
|
||||
public MimeMessage build() {
|
||||
try {
|
||||
return buildMsg();
|
||||
} catch (MessagingException e) {
|
||||
throw new MailException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送
|
||||
*
|
||||
|
@@ -345,7 +345,7 @@ public class MailUtil {
|
||||
* @since 4.6.3
|
||||
*/
|
||||
public static String send(MailAccount mailAccount, Collection<String> tos, Collection<String> ccs, Collection<String> bccs, String subject, String content, Map<String, InputStream> imageMap,
|
||||
boolean isHtml, File... files) {
|
||||
boolean isHtml, File... files) {
|
||||
return send(mailAccount, false, tos, ccs, bccs, subject, content, imageMap, isHtml, files);
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ public class MailUtil {
|
||||
* @return {@link Session}
|
||||
* @since 5.5.7
|
||||
*/
|
||||
public static Session getSession(MailAccount mailAccount, boolean isSingleton){
|
||||
public static Session getSession(MailAccount mailAccount, boolean isSingleton) {
|
||||
Authenticator authenticator = null;
|
||||
if (mailAccount.isAuth()) {
|
||||
authenticator = new UserPassAuthenticator(mailAccount.getUser(), mailAccount.getPass());
|
||||
@@ -386,7 +386,7 @@ public class MailUtil {
|
||||
* @since 4.6.3
|
||||
*/
|
||||
private static String send(MailAccount mailAccount, boolean useGlobalSession, Collection<String> tos, Collection<String> ccs, Collection<String> bccs, String subject, String content,
|
||||
Map<String, InputStream> imageMap, boolean isHtml, File... files) {
|
||||
Map<String, InputStream> imageMap, boolean isHtml, File... files) {
|
||||
final Mail mail = Mail.create(mailAccount).setUseGlobalSession(useGlobalSession);
|
||||
|
||||
// 可选抄送人
|
||||
|
Reference in New Issue
Block a user