Skip to content

Commit 58d3427

Browse files
committed
CLAP-150 Fix: email config 추가
<footer> - 관련: #123
1 parent ee382d3 commit 58d3427

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package clap.server.config.mail;
2+
3+
import org.springframework.beans.factory.annotation.Value;
4+
import org.springframework.context.annotation.Bean;
5+
import org.springframework.context.annotation.Configuration;
6+
import org.springframework.mail.javamail.JavaMailSender;
7+
import org.springframework.mail.javamail.JavaMailSenderImpl;
8+
9+
import java.util.Properties;
10+
11+
@Configuration
12+
public class EmailConfig {
13+
14+
@Value("${spring.mail.host}")
15+
private String host;
16+
17+
@Value("${spring.mail.port}")
18+
private int port;
19+
20+
@Value("${spring.mail.username}")
21+
private String username;
22+
23+
@Value("${spring.mail.password}")
24+
private String password;
25+
26+
@Bean
27+
public JavaMailSender javaMailSender() {
28+
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
29+
mailSender.setHost(host);
30+
mailSender.setPort(port);
31+
mailSender.setUsername(username);
32+
mailSender.setPassword(password);
33+
34+
Properties props = mailSender.getJavaMailProperties();
35+
props.put("mail.transport.protocol", "smtp");
36+
props.put("mail.smtp.auth", "true");
37+
props.put("mail.smtp.starttls.enable", "true");
38+
props.put("mail.debug", "true");
39+
40+
return mailSender;
41+
}
42+
}
43+

0 commit comments

Comments
 (0)