package com.elab.alert.model.mail;

import java.util.Properties;

/**
 * 发送邮件参数承装对象
 *
 * @author : liukx
 * @create : 2018/11/19 10:00
 * @email : liukx@elab-plus.com
 */
public class MailSenderInfo {

    private String host;     //邮件域名  默认从配置文件里面获取
    private String port;   //默认邮件端口  默认从配置文件里面获取
    private String socketFactoryClass = "javax.net.ssl.SSLSocketFactory";
    private String username;     //发件人邮件帐号  默认从配置文件里面获取
    private String password;     //发件人邮件密码  默认从配置文件里面获取
    private String type;    //邮件内容类型   默认从配置文件里面获取text/html
    private String fromAddress;   //邮件发送人  默认从配置文件里面获取

    private String toAddress;    //邮件接收人
    private boolean validate = false;

    private String subject;     //邮件主题/标题

    private String content;     //邮件内容

    private String enclosureName;   //邮件附件名称


    /**
     * 获得邮件会话属性
     *
     * @return
     */
    public Properties getProperties() {
        Properties p = new Properties();
        p.put("mail.smtp.localhost", "127.0.0.1");
        p.put("mail.smtp.host", this.host);
        p.put("mail.smtp.port", this.port);
        p.put("mail.smtp.socketFactory.class", this.socketFactoryClass);
        p.put("mail.smtp.socketFactory.port", this.port);
        p.put("mail.smtp.auth", validate ? "true" : "false");
        return p;
    }


    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getPort() {
        return port;
    }

    public void setPort(String port) {
        this.port = port;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getFromAddress() {
        return fromAddress;
    }

    public void setFromAddress(String fromAddress) {
        this.fromAddress = fromAddress;
    }

    public String getToAddress() {
        return toAddress;
    }

    public void setToAddress(String toAddress) {
        this.toAddress = toAddress;
    }

    public boolean isValidate() {
        return validate;
    }

    public void setValidate(boolean validate) {
        this.validate = validate;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getEnclosureName() {
        return enclosureName;
    }

    public void setEnclosureName(String enclosureName) {
        this.enclosureName = enclosureName;
    }

}
