mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	update 重构 pr_172 集成邮件发送功能
This commit is contained in:
		
							
								
								
									
										1
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								pom.xml
									
									
									
									
									
								
							@@ -38,7 +38,6 @@
 | 
				
			|||||||
        <dynamic-ds.version>3.5.1</dynamic-ds.version>
 | 
					        <dynamic-ds.version>3.5.1</dynamic-ds.version>
 | 
				
			||||||
        <tlog.version>1.3.6</tlog.version>
 | 
					        <tlog.version>1.3.6</tlog.version>
 | 
				
			||||||
        <xxl-job.version>2.3.0</xxl-job.version>
 | 
					        <xxl-job.version>2.3.0</xxl-job.version>
 | 
				
			||||||
        <mail.version>1.6.2</mail.version>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- jdk11 缺失依赖 jaxb-->
 | 
					        <!-- jdk11 缺失依赖 jaxb-->
 | 
				
			||||||
        <jaxb.version>3.0.1</jaxb.version>
 | 
					        <jaxb.version>3.0.1</jaxb.version>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -137,34 +137,6 @@ spring:
 | 
				
			|||||||
    # 是否开启ssl
 | 
					    # 是否开启ssl
 | 
				
			||||||
    ssl: false
 | 
					    ssl: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # 邮件
 | 
					 | 
				
			||||||
  mail:
 | 
					 | 
				
			||||||
    enabled: false
 | 
					 | 
				
			||||||
    # 邮件服务地址 (enabled = true 时打开该配置)
 | 
					 | 
				
			||||||
#    host: smtp.qq.com
 | 
					 | 
				
			||||||
    # 用户名
 | 
					 | 
				
			||||||
    username: xxx@qq.com
 | 
					 | 
				
			||||||
    # 授权码 (设置 - 账户 - POP3/SMTP服务)
 | 
					 | 
				
			||||||
    password: xxx
 | 
					 | 
				
			||||||
    # QQ邮箱加密端口,不同邮箱的端口不一样
 | 
					 | 
				
			||||||
    port: 465
 | 
					 | 
				
			||||||
    properties:
 | 
					 | 
				
			||||||
      mail:
 | 
					 | 
				
			||||||
        smtp:
 | 
					 | 
				
			||||||
          socketFactory:
 | 
					 | 
				
			||||||
            class: javax.net.ssl.SSLSocketFactory
 | 
					 | 
				
			||||||
          ssl:
 | 
					 | 
				
			||||||
            trust: smtp.qq.com
 | 
					 | 
				
			||||||
          # 是否需要用户认证
 | 
					 | 
				
			||||||
          auth: true
 | 
					 | 
				
			||||||
          starttls:
 | 
					 | 
				
			||||||
            # 启用TLS加密
 | 
					 | 
				
			||||||
            enable: true
 | 
					 | 
				
			||||||
            required: true
 | 
					 | 
				
			||||||
    # 传输协议 starttls.enable = true 时为 smtps
 | 
					 | 
				
			||||||
    protocol: smtps
 | 
					 | 
				
			||||||
    debug: true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
redisson:
 | 
					redisson:
 | 
				
			||||||
  # 线程池数量
 | 
					  # 线程池数量
 | 
				
			||||||
  threads: 4
 | 
					  threads: 4
 | 
				
			||||||
@@ -184,3 +156,25 @@ redisson:
 | 
				
			|||||||
    timeout: 3000
 | 
					    timeout: 3000
 | 
				
			||||||
    # 发布和订阅连接池大小
 | 
					    # 发布和订阅连接池大小
 | 
				
			||||||
    subscriptionConnectionPoolSize: 50
 | 
					    subscriptionConnectionPoolSize: 50
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--- # mail 邮件发送
 | 
				
			||||||
 | 
					mail:
 | 
				
			||||||
 | 
					  enabled: false
 | 
				
			||||||
 | 
					  host: smtp.163.com
 | 
				
			||||||
 | 
					  port: 465
 | 
				
			||||||
 | 
					  # 是否需要用户名密码验证
 | 
				
			||||||
 | 
					  auth: true
 | 
				
			||||||
 | 
					  # 发送方,遵循RFC-822标准
 | 
				
			||||||
 | 
					  from: xxx@163.com
 | 
				
			||||||
 | 
					  # 用户名(注意:如果使用foxmail邮箱,此处user为qq号)
 | 
				
			||||||
 | 
					  user: xxx@163.com
 | 
				
			||||||
 | 
					  # 密码(注意,某些邮箱需要为SMTP服务单独设置密码,详情查看相关帮助)
 | 
				
			||||||
 | 
					  pass: xxxxxxxxxx
 | 
				
			||||||
 | 
					  # 使用 STARTTLS安全连接,STARTTLS是对纯文本通信协议的扩展。
 | 
				
			||||||
 | 
					  starttlsEnable: true
 | 
				
			||||||
 | 
					  # 使用SSL安全连接
 | 
				
			||||||
 | 
					  sslEnable: true
 | 
				
			||||||
 | 
					  # SMTP超时时长,单位毫秒,缺省值不超时
 | 
				
			||||||
 | 
					  timeout: 0
 | 
				
			||||||
 | 
					  # Socket连接超时值,单位毫秒,缺省值不超时
 | 
				
			||||||
 | 
					  connectionTimeout: 0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -159,3 +159,25 @@ redisson:
 | 
				
			|||||||
    timeout: 3000
 | 
					    timeout: 3000
 | 
				
			||||||
    # 发布和订阅连接池大小
 | 
					    # 发布和订阅连接池大小
 | 
				
			||||||
    subscriptionConnectionPoolSize: 50
 | 
					    subscriptionConnectionPoolSize: 50
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--- # mail 邮件发送
 | 
				
			||||||
 | 
					mail:
 | 
				
			||||||
 | 
					  enabled: false
 | 
				
			||||||
 | 
					  host: smtp.163.com
 | 
				
			||||||
 | 
					  port: 465
 | 
				
			||||||
 | 
					  # 是否需要用户名密码验证
 | 
				
			||||||
 | 
					  auth: true
 | 
				
			||||||
 | 
					  # 发送方,遵循RFC-822标准
 | 
				
			||||||
 | 
					  from: xxx@163.com
 | 
				
			||||||
 | 
					  # 用户名(注意:如果使用foxmail邮箱,此处user为qq号)
 | 
				
			||||||
 | 
					  user: xxx@163.com
 | 
				
			||||||
 | 
					  # 密码(注意,某些邮箱需要为SMTP服务单独设置密码,详情查看相关帮助)
 | 
				
			||||||
 | 
					  pass: xxxxxxxxxx
 | 
				
			||||||
 | 
					  # 使用 STARTTLS安全连接,STARTTLS是对纯文本通信协议的扩展。
 | 
				
			||||||
 | 
					  starttlsEnable: true
 | 
				
			||||||
 | 
					  # 使用SSL安全连接
 | 
				
			||||||
 | 
					  sslEnable: true
 | 
				
			||||||
 | 
					  # SMTP超时时长,单位毫秒,缺省值不超时
 | 
				
			||||||
 | 
					  timeout: 0
 | 
				
			||||||
 | 
					  # Socket连接超时值,单位毫秒,缺省值不超时
 | 
				
			||||||
 | 
					  connectionTimeout: 0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -127,6 +127,11 @@
 | 
				
			|||||||
            <artifactId>hutool-extra</artifactId>
 | 
					            <artifactId>hutool-extra</artifactId>
 | 
				
			||||||
        </dependency>
 | 
					        </dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>com.sun.mail</groupId>
 | 
				
			||||||
 | 
					            <artifactId>jakarta.mail</artifactId>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <dependency>
 | 
					        <dependency>
 | 
				
			||||||
            <groupId>org.projectlombok</groupId>
 | 
					            <groupId>org.projectlombok</groupId>
 | 
				
			||||||
            <artifactId>lombok</artifactId>
 | 
					            <artifactId>lombok</artifactId>
 | 
				
			||||||
@@ -159,12 +164,6 @@
 | 
				
			|||||||
            <artifactId>lock4j-redisson-spring-boot-starter</artifactId>
 | 
					            <artifactId>lock4j-redisson-spring-boot-starter</artifactId>
 | 
				
			||||||
        </dependency>
 | 
					        </dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <dependency>
 | 
					 | 
				
			||||||
            <groupId>com.sun.mail</groupId>
 | 
					 | 
				
			||||||
            <artifactId>javax.mail</artifactId>
 | 
					 | 
				
			||||||
            <version>${mail.version}</version>
 | 
					 | 
				
			||||||
        </dependency>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    </dependencies>
 | 
					    </dependencies>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,13 +38,13 @@ public class MailUtils {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 获取邮件发送实例 (自定义发送人以及授权码)
 | 
					     * 获取邮件发送实例 (自定义发送人以及授权码)
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param username 发送人
 | 
					     * @param user 发送人
 | 
				
			||||||
     * @param password 授权码
 | 
					     * @param pass 授权码
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static MailAccount getMailAccount(String username, String password) {
 | 
					    public static MailAccount getMailAccount(String from, String user, String pass) {
 | 
				
			||||||
        ACCOUNT.setFrom(StringUtils.blankToDefault(username, ACCOUNT.getUser()));
 | 
					        ACCOUNT.setFrom(StringUtils.blankToDefault(from, ACCOUNT.getFrom()));
 | 
				
			||||||
        ACCOUNT.setUser(StringUtils.blankToDefault(username, ACCOUNT.getUser()));
 | 
					        ACCOUNT.setUser(StringUtils.blankToDefault(user, ACCOUNT.getUser()));
 | 
				
			||||||
        ACCOUNT.setPass(StringUtils.blankToDefault(password, ACCOUNT.getPass()));
 | 
					        ACCOUNT.setPass(StringUtils.blankToDefault(pass, ACCOUNT.getPass()));
 | 
				
			||||||
        return ACCOUNT;
 | 
					        return ACCOUNT;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,8 @@ package com.ruoyi.demo.controller;
 | 
				
			|||||||
import com.ruoyi.common.core.domain.R;
 | 
					import com.ruoyi.common.core.domain.R;
 | 
				
			||||||
import com.ruoyi.common.utils.email.MailUtils;
 | 
					import com.ruoyi.common.utils.email.MailUtils;
 | 
				
			||||||
import io.swagger.annotations.Api;
 | 
					import io.swagger.annotations.Api;
 | 
				
			||||||
 | 
					import io.swagger.annotations.ApiOperation;
 | 
				
			||||||
 | 
					import io.swagger.annotations.ApiParam;
 | 
				
			||||||
import lombok.RequiredArgsConstructor;
 | 
					import lombok.RequiredArgsConstructor;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.validation.annotation.Validated;
 | 
					import org.springframework.validation.annotation.Validated;
 | 
				
			||||||
@@ -14,41 +16,34 @@ import java.io.File;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 测试邮件发送 Controller
 | 
					 * 邮件发送案例
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @author Michelle.Chung
 | 
					 * @author Michelle.Chung
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@Validated
 | 
					@Validated
 | 
				
			||||||
@Api(value = "邮件控制器", tags = {"测试邮件发送"})
 | 
					@Api(value = "邮件发送案例", tags = {"邮件发送案例"})
 | 
				
			||||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
 | 
					@RequiredArgsConstructor(onConstructor_ = @Autowired)
 | 
				
			||||||
@RequestMapping("/demo/mail")
 | 
					@RequestMapping("/demo/mail")
 | 
				
			||||||
@RestController
 | 
					@RestController
 | 
				
			||||||
public class MailController {
 | 
					public class MailController {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    @ApiOperation("发送邮件")
 | 
				
			||||||
     * 发送邮件
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * @param to      接收人
 | 
					 | 
				
			||||||
     * @param subject 标题
 | 
					 | 
				
			||||||
     * @param text    内容
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    @GetMapping("/sendSimpleMessage")
 | 
					    @GetMapping("/sendSimpleMessage")
 | 
				
			||||||
    public R<Void> sendSimpleMessage(String to, String subject, String text) {
 | 
					    public R<Void> sendSimpleMessage(@ApiParam("接收人") String to,
 | 
				
			||||||
        MailUtils.send(to, subject, text, false);
 | 
					                                     @ApiParam("标题") String subject,
 | 
				
			||||||
        return R.ok("操作成功");
 | 
					                                     @ApiParam("内容") String text) {
 | 
				
			||||||
 | 
					        MailUtils.sendText(to, subject, text);
 | 
				
			||||||
 | 
					        return R.ok();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    @ApiOperation("发送邮件(带附件)")
 | 
				
			||||||
     * 发送邮件(带附件)
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * @param to      接收人
 | 
					 | 
				
			||||||
     * @param subject 标题
 | 
					 | 
				
			||||||
     * @param text    内容
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    @GetMapping("/sendMessageWithAttachment")
 | 
					    @GetMapping("/sendMessageWithAttachment")
 | 
				
			||||||
    public R<Void> sendMessageWithAttachment(String to, String subject, String text, String filePath) {
 | 
					    public R<Void> sendMessageWithAttachment(@ApiParam("接收人") String to,
 | 
				
			||||||
        MailUtils.send(to, subject, text, false, new File(filePath));
 | 
					                                             @ApiParam("标题") String subject,
 | 
				
			||||||
        return R.ok("操作成功");
 | 
					                                             @ApiParam("内容") String text,
 | 
				
			||||||
 | 
					                                             @ApiParam("附件路径") String filePath) {
 | 
				
			||||||
 | 
					        MailUtils.sendText(to, subject, text, new File(filePath));
 | 
				
			||||||
 | 
					        return R.ok();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,8 +6,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 | 
				
			|||||||
import org.springframework.context.annotation.Bean;
 | 
					import org.springframework.context.annotation.Bean;
 | 
				
			||||||
import org.springframework.context.annotation.Configuration;
 | 
					import org.springframework.context.annotation.Configuration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.annotation.Resource;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * JavaMail 配置
 | 
					 * JavaMail 配置
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@@ -16,23 +14,21 @@ import javax.annotation.Resource;
 | 
				
			|||||||
@Configuration
 | 
					@Configuration
 | 
				
			||||||
public class MailConfig {
 | 
					public class MailConfig {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Resource
 | 
					 | 
				
			||||||
    private MailProperties mailProperties;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 初始化 JavaMailSender
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    @Bean
 | 
					    @Bean
 | 
				
			||||||
    @ConditionalOnProperty(value = "spring.mail.enabled", havingValue = "true")
 | 
					    @ConditionalOnProperty(value = "mail.enabled", havingValue = "true")
 | 
				
			||||||
    public MailAccount mailAccount() {
 | 
					    public MailAccount mailAccount(MailProperties mailProperties) {
 | 
				
			||||||
        MailAccount account = new MailAccount();
 | 
					        MailAccount account = new MailAccount();
 | 
				
			||||||
        account.setFrom(mailProperties.getUsername());
 | 
					        account.setHost(mailProperties.getHost());
 | 
				
			||||||
        account.setUser(mailProperties.getUsername());
 | 
					 | 
				
			||||||
        account.setPass(mailProperties.getPassword());
 | 
					 | 
				
			||||||
        account.setPort(mailProperties.getPort());
 | 
					        account.setPort(mailProperties.getPort());
 | 
				
			||||||
        account.setAuth(mailProperties.getAuth());
 | 
					        account.setAuth(mailProperties.getAuth());
 | 
				
			||||||
        account.setDebug(mailProperties.getDebug());
 | 
					        account.setFrom(mailProperties.getFrom());
 | 
				
			||||||
 | 
					        account.setUser(mailProperties.getUser());
 | 
				
			||||||
 | 
					        account.setPass(mailProperties.getPass());
 | 
				
			||||||
 | 
					        account.setSocketFactoryPort(mailProperties.getPort());
 | 
				
			||||||
        account.setStarttlsEnable(mailProperties.getStarttlsEnable());
 | 
					        account.setStarttlsEnable(mailProperties.getStarttlsEnable());
 | 
				
			||||||
 | 
					        account.setSslEnable(mailProperties.getSslEnable());
 | 
				
			||||||
 | 
					        account.setTimeout(mailProperties.getTimeout());
 | 
				
			||||||
 | 
					        account.setConnectionTimeout(mailProperties.getConnectionTimeout());
 | 
				
			||||||
        return account;
 | 
					        return account;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,6 @@
 | 
				
			|||||||
package com.ruoyi.framework.config.properties;
 | 
					package com.ruoyi.framework.config.properties;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Value;
 | 
					 | 
				
			||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
 | 
					import org.springframework.boot.context.properties.ConfigurationProperties;
 | 
				
			||||||
import org.springframework.stereotype.Component;
 | 
					import org.springframework.stereotype.Component;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -12,7 +11,7 @@ import org.springframework.stereotype.Component;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
@Component
 | 
					@Component
 | 
				
			||||||
@ConfigurationProperties(prefix = "spring.mail")
 | 
					@ConfigurationProperties(prefix = "mail")
 | 
				
			||||||
public class MailProperties {
 | 
					public class MailProperties {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -21,45 +20,52 @@ public class MailProperties {
 | 
				
			|||||||
    private String enabled;
 | 
					    private String enabled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 邮件服务地址
 | 
					     * SMTP服务器域名
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private String host;
 | 
					    private String host;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 用户名
 | 
					     * SMTP服务端口
 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private String username;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 授权码 (设置 - 账户 - POP3/SMTP服务)
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private String password;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 邮箱加密端口,不同邮箱的端口不一样
 | 
					 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private Integer port;
 | 
					    private Integer port;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 是否需要用户认证
 | 
					     * 是否需要用户名密码验证
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Value("${spring.mail.properties.mail.smtp.auth}")
 | 
					 | 
				
			||||||
    private Boolean auth;
 | 
					    private Boolean auth;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 是否启用TLS加密
 | 
					     * 用户名
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Value("${spring.mail.properties.mail.smtp.starttls.enable}")
 | 
					    private String user;
 | 
				
			||||||
    private Boolean starttlsEnable;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Value("${spring.mail.properties.mail.smtp.ssl.trust}")
 | 
					 | 
				
			||||||
    private String sslTrust;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private Boolean debug;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 传输协议 starttls.enable = true 时为 smtps
 | 
					     * 密码
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private String protocol;
 | 
					    private String pass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 发送方,遵循RFC-822标准
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String from;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 使用 STARTTLS安全连接,STARTTLS是对纯文本通信协议的扩展。它将纯文本连接升级为加密连接(TLS或SSL), 而不是使用一个单独的加密通信端口。
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Boolean starttlsEnable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 使用 SSL安全连接
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Boolean sslEnable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * SMTP超时时长,单位毫秒,缺省值不超时
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Long timeout;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Socket连接超时值,单位毫秒,缺省值不超时
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Long connectionTimeout;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user