All Downloads are FREE. Search and download functionalities are using the official Maven repository.

lodsve.core.configuration.MailProperties Maven / Gradle / Ivy

/*
 * Copyright (C) 2018  Sun.Hao
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see .
 */

package lodsve.core.configuration;

import lodsve.core.properties.relaxedbind.annotations.ConfigurationProperties;
import lodsve.core.properties.relaxedbind.annotations.Required;
import lombok.Getter;
import lombok.Setter;

import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;

/**
 * 邮箱服务器的配置.
 *
 * @author sunhao([email protected])
 * @date 16/5/26 下午2:57
 */
@ConfigurationProperties(prefix = "lodsve.mail", locations = "${params.root}/framework/mail.properties")
@Setter
@Getter
public class MailProperties {
    private static final String DEFAULT_CHARSET = StandardCharsets.UTF_8.name();

    /**
     * SMTP server host. For instance, `smtp.example.com`.
     */
    @Required
    private String host;

    /**
     * SMTP server port.
     */
    @Required
    private Integer port;

    /**
     * Login user of the SMTP server.
     */
    private String username;

    /**
     * Login password of the SMTP server.
     */
    private String password;

    /**
     * Protocol used by the SMTP server.
     */
    private String protocol = "smtp";

    /**
     * Default MimeMessage encoding.
     */
    private String defaultEncoding = DEFAULT_CHARSET;

    /**
     * Additional JavaMail Session properties.
     */
    private Map properties = new HashMap<>();

    /**
     * Session JNDI name. When set, takes precedence over other Session settings.
     */
    private String jndiName;

    /**
     * Whether to test that the mail server is available on startup.
     */
    private boolean testConnection;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy