-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from lab-cherry/develop
Release v0.55
- Loading branch information
Showing
36 changed files
with
2,630 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
nw/src/main/java/lab/cherry/nw/configuration/email/EmailConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package lab.cherry.nw.configuration.email; | ||
|
||
import java.util.Properties; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.PropertySource; | ||
import org.springframework.mail.javamail.JavaMailSender; | ||
import org.springframework.mail.javamail.JavaMailSenderImpl; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
|
||
//@ConfigurationProperties(prefix = "mail") | ||
@Configuration | ||
@PropertySource("classpath:application.properties") | ||
public class EmailConfig { | ||
@Value("${spring.mail.username}") | ||
private String id; | ||
@Value("${spring.mail.password}") | ||
private String password; | ||
@Value("${spring.mail.host}") | ||
private String host; | ||
@Value("${spring.mail.port}") | ||
private int port; | ||
|
||
@Bean | ||
public JavaMailSender javaMailService() { | ||
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl(); | ||
|
||
javaMailSender.setHost(host); // smtp 서버 주소 | ||
javaMailSender.setUsername(id); // 설정(발신) 메일 아이디 | ||
javaMailSender.setPassword(password); // 설정(발신) 메일 패스워드 | ||
javaMailSender.setPort(port); //smtp port | ||
javaMailSender.setJavaMailProperties(getMailProperties()); // 메일 인증서버 정보 가져온다. | ||
javaMailSender.setDefaultEncoding("UTF-8"); | ||
return javaMailSender; | ||
} | ||
|
||
private Properties getMailProperties() { | ||
Properties properties = new Properties(); | ||
properties.setProperty("mail.transport.protocol", "smtp"); // 프로토콜 설정 | ||
properties.setProperty("mail.smtp.auth", "true"); // smtp 인증 | ||
properties.setProperty("mail.smtp.starttls.enable", "true"); // smtp starttls 사용 | ||
properties.setProperty("mail.debug", "true"); // 디버그 사용 | ||
// properties.setProperty("mail.smtp.ssl.trust","smtp.mailplug.co.kr"); // ssl 인증 서버 주소 | ||
properties.setProperty("mail.smtp.ssl.trust","smtp.naver.com"); // ssl 인증 서버 주소 | ||
|
||
properties.setProperty("mail.smtp.ssl.enable","false"); // ssl 사용 | ||
return properties; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.