-
Notifications
You must be signed in to change notification settings - Fork 0
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 #58 from ssu-student-union/feat/55-onboarding
[feat] 온보딩 실패 시 문의 메일 api 추가
- Loading branch information
Showing
7 changed files
with
115 additions
and
1 deletion.
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
16 changes: 16 additions & 0 deletions
16
...main/java/ussum/homepage/application/user/service/dto/request/OnBoardingEmailRequest.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,16 @@ | ||
package ussum.homepage.application.user.service.dto.request; | ||
|
||
|
||
public record OnBoardingEmailRequest( | ||
String name, | ||
Long studentId, | ||
String email, | ||
String content | ||
) { | ||
public String toString(OnBoardingEmailRequest onBoardingEmailRequest) { | ||
return onBoardingEmailRequest.studentId + "학번과 " | ||
+ onBoardingEmailRequest.email + " 라는 이메일을 가진 " | ||
+ onBoardingEmailRequest.name + "님이 " | ||
+ "메일을 보냈습니다."; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/ussum/homepage/domain/user/exception/OnBoardingMessagingException.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,11 @@ | ||
package ussum.homepage.domain.user.exception; | ||
|
||
import ussum.homepage.global.error.code.BaseErrorCode; | ||
import ussum.homepage.global.error.exception.GeneralException; | ||
|
||
public class OnBoardingMessagingException extends GeneralException { | ||
private BaseErrorCode baseErrorCode; | ||
public OnBoardingMessagingException(BaseErrorCode baseErrorCode) { | ||
super(baseErrorCode); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
src/main/java/ussum/homepage/global/config/MailConfig.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,49 @@ | ||
package ussum.homepage.global.config; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.mail.javamail.JavaMailSender; | ||
import org.springframework.mail.javamail.JavaMailSenderImpl; | ||
|
||
import java.util.Properties; | ||
|
||
@Configuration | ||
public class MailConfig { | ||
@Value("${spring.mail.host}") | ||
private String MAIL_HOST; | ||
|
||
@Value("${spring.mail.username}") | ||
private String MAIL_ADDRESS; | ||
|
||
@Value("${spring.mail.password}") | ||
private String MAIL_PASSWORD; | ||
|
||
@Bean | ||
public JavaMailSender javaMailService() { | ||
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl(); | ||
|
||
// SMTP 서버 주소를 'smtp.gmail.com'으로 변경 | ||
javaMailSender.setHost(MAIL_HOST); | ||
javaMailSender.setUsername(MAIL_ADDRESS); // 사용자 이메일 주소 | ||
javaMailSender.setPassword(MAIL_PASSWORD); // 앱 비밀번호 또는 사용자 비밀번호 | ||
|
||
// TLS를 사용하는 587 포트 설정 | ||
javaMailSender.setPort(587); | ||
javaMailSender.setJavaMailProperties(getMailProperties()); | ||
|
||
return javaMailSender; | ||
} | ||
|
||
private Properties getMailProperties() { | ||
Properties properties = new Properties(); | ||
properties.setProperty("mail.transport.protocol", "smtp"); | ||
properties.setProperty("mail.smtp.auth", "true"); | ||
properties.setProperty("mail.smtp.starttls.enable", "true"); // TLS 활성화 | ||
properties.setProperty("mail.debug", "true"); | ||
|
||
// 'smtp.gmail.com'으로 변경 | ||
properties.setProperty("mail.smtp.ssl.trust", "smtp.gmail.com"); | ||
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