001/*
002 * Copyright 2012-2018 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.boot.autoconfigure.mail;
018
019import java.nio.charset.Charset;
020import java.nio.charset.StandardCharsets;
021import java.util.HashMap;
022import java.util.Map;
023
024import org.springframework.boot.context.properties.ConfigurationProperties;
025
026/**
027 * Configuration properties for email support.
028 *
029 * @author Oliver Gierke
030 * @author Stephane Nicoll
031 * @author EddĂș MelĂ©ndez
032 * @since 1.2.0
033 */
034@ConfigurationProperties(prefix = "spring.mail")
035public class MailProperties {
036
037        private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
038
039        /**
040         * SMTP server host. For instance, `smtp.example.com`.
041         */
042        private String host;
043
044        /**
045         * SMTP server port.
046         */
047        private Integer port;
048
049        /**
050         * Login user of the SMTP server.
051         */
052        private String username;
053
054        /**
055         * Login password of the SMTP server.
056         */
057        private String password;
058
059        /**
060         * Protocol used by the SMTP server.
061         */
062        private String protocol = "smtp";
063
064        /**
065         * Default MimeMessage encoding.
066         */
067        private Charset defaultEncoding = DEFAULT_CHARSET;
068
069        /**
070         * Additional JavaMail Session properties.
071         */
072        private Map<String, String> properties = new HashMap<>();
073
074        /**
075         * Session JNDI name. When set, takes precedence over other Session settings.
076         */
077        private String jndiName;
078
079        public String getHost() {
080                return this.host;
081        }
082
083        public void setHost(String host) {
084                this.host = host;
085        }
086
087        public Integer getPort() {
088                return this.port;
089        }
090
091        public void setPort(Integer port) {
092                this.port = port;
093        }
094
095        public String getUsername() {
096                return this.username;
097        }
098
099        public void setUsername(String username) {
100                this.username = username;
101        }
102
103        public String getPassword() {
104                return this.password;
105        }
106
107        public void setPassword(String password) {
108                this.password = password;
109        }
110
111        public String getProtocol() {
112                return this.protocol;
113        }
114
115        public void setProtocol(String protocol) {
116                this.protocol = protocol;
117        }
118
119        public Charset getDefaultEncoding() {
120                return this.defaultEncoding;
121        }
122
123        public void setDefaultEncoding(Charset defaultEncoding) {
124                this.defaultEncoding = defaultEncoding;
125        }
126
127        public Map<String, String> getProperties() {
128                return this.properties;
129        }
130
131        public void setJndiName(String jndiName) {
132                this.jndiName = jndiName;
133        }
134
135        public String getJndiName() {
136                return this.jndiName;
137        }
138
139}