001/* 002 * Copyright 2012-2015 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.util.HashMap; 021import java.util.Map; 022 023import org.springframework.boot.context.properties.ConfigurationProperties; 024 025/** 026 * Configuration properties for email support. 027 * 028 * @author Oliver Gierke 029 * @author Stephane Nicoll 030 * @author Eddú Meléndez 031 * @since 1.2.0 032 */ 033@ConfigurationProperties(prefix = "spring.mail") 034public class MailProperties { 035 036 private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); 037 038 /** 039 * SMTP server host. 040 */ 041 private String host; 042 043 /** 044 * SMTP server port. 045 */ 046 private Integer port; 047 048 /** 049 * Login user of the SMTP server. 050 */ 051 private String username; 052 053 /** 054 * Login password of the SMTP server. 055 */ 056 private String password; 057 058 /** 059 * Protocol used by the SMTP server. 060 */ 061 private String protocol = "smtp"; 062 063 /** 064 * Default MimeMessage encoding. 065 */ 066 private Charset defaultEncoding = DEFAULT_CHARSET; 067 068 /** 069 * Additional JavaMail session properties. 070 */ 071 private Map<String, String> properties = new HashMap<String, String>(); 072 073 /** 074 * Session JNDI name. When set, takes precedence to others mail settings. 075 */ 076 private String jndiName; 077 078 /** 079 * Test that the mail server is available on startup. 080 */ 081 private boolean testConnection; 082 083 public String getHost() { 084 return this.host; 085 } 086 087 public void setHost(String host) { 088 this.host = host; 089 } 090 091 public Integer getPort() { 092 return this.port; 093 } 094 095 public void setPort(Integer port) { 096 this.port = port; 097 } 098 099 public String getUsername() { 100 return this.username; 101 } 102 103 public void setUsername(String username) { 104 this.username = username; 105 } 106 107 public String getPassword() { 108 return this.password; 109 } 110 111 public void setPassword(String password) { 112 this.password = password; 113 } 114 115 public String getProtocol() { 116 return this.protocol; 117 } 118 119 public void setProtocol(String protocol) { 120 this.protocol = protocol; 121 } 122 123 public Charset getDefaultEncoding() { 124 return this.defaultEncoding; 125 } 126 127 public void setDefaultEncoding(Charset defaultEncoding) { 128 this.defaultEncoding = defaultEncoding; 129 } 130 131 public Map<String, String> getProperties() { 132 return this.properties; 133 } 134 135 public void setJndiName(String jndiName) { 136 this.jndiName = jndiName; 137 } 138 139 public String getJndiName() { 140 return this.jndiName; 141 } 142 143 public boolean isTestConnection() { 144 return this.testConnection; 145 } 146 147 public void setTestConnection(boolean testConnection) { 148 this.testConnection = testConnection; 149 } 150 151}