- 
                Notifications
    
You must be signed in to change notification settings  - Fork 0
 
[fix] email 보내기 API 수정 #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
  
     Merged
                    Changes from 10 commits
      Commits
    
    
            Show all changes
          
          
            11 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      639bbe9
              
                fix: 면접 예약 API 면접 일정 조회시 status도 같이 반환
              
              
                hodoon 0027cfd
              
                Merge branch 'fix/#59-1' into dev
              
              
                hodoon 2ea02c0
              
                fix: 면접 예약 API 예약자 명단 조회 API 추가
              
              
                hodoon 7112252
              
                fix: 면접 예약 API 예약되어있는 슬롯은 삭제하지 않는 기능 추가
              
              
                hodoon 5e118c7
              
                Merge branch 'dev' of https://github.com/DASOM-GitHub/dasom-web-backe…
              
              
                hodoon 311122c
              
                fix: 면접 예약자 조회 API 면접일, 면접시간, 면접을 예약한 날짜과 시간 추가
              
              
                hodoon 5ed900c
              
                Merge branch 'dev' of https://github.com/DASOM-GitHub/dasom-web-backe…
              
              
                hodoon 47e6d4f
              
                Merge branch 'feat/#61-1' into dev
              
              
                hodoon 0672e0c
              
                Merge branch 'fix/#59-2' into dev
              
              
                hodoon 6830da8
              
                fix: email 보내기 API 수정
              
              
                hodoon 91a746f
              
                fix: email 전송 API 버튼 URL 수정
              
              
                hodoon File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
        
          
          
            35 changes: 35 additions & 0 deletions
          
          35 
        
  src/main/java/dmu/dasom/api/domain/email/config/EmailConfig.java
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or 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,35 @@ | ||
| package dmu.dasom.api.domain.email.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 EmailConfig { | ||
| 
     | 
||
| @Value("${spring.mail.username}") | ||
| private String username; | ||
| @Value("${spring.mail.password}") | ||
| private String password; | ||
| 
     | 
||
| @Bean | ||
| public JavaMailSender javaMailSender() { | ||
| JavaMailSenderImpl mailSender = new JavaMailSenderImpl(); | ||
| mailSender.setHost("smtp.gmail.com"); | ||
| mailSender.setPort(587); | ||
| mailSender.setUsername(username); | ||
| mailSender.setPassword(password); | ||
| 
     | 
||
| Properties props = mailSender.getJavaMailProperties(); | ||
| props.put("mail.transport.protocol", "smtp"); | ||
| props.put("mail.smtp.auth", "true"); | ||
| props.put("mail.smtp.starttls.enable", "true"); | ||
| props.put("mail.debug", "true"); | ||
| 
     | 
||
| return mailSender; | ||
| } | ||
| } | 
  
    
      This file contains hidden or 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 | 
|---|---|---|
| 
          
            
          
           | 
    @@ -17,33 +17,36 @@ | |
| @Service | ||
| public class EmailService { | ||
| 
     | 
||
| private JavaMailSender javaMailSender; | ||
| private TemplateEngine templateEngine; | ||
| private final TemplateEngine templateEngine; | ||
| private final JavaMailSender javaMailSender; | ||
| 
     | 
||
| @Value("${spring.mail.username}") | ||
| private String from; | ||
| 
     | 
||
| public void sendEmail(String to, String name, MailType mailType) throws MessagingException { | ||
| if (mailType == null){ | ||
| throw new CustomException(ErrorCode.MAIL_TYPE_NOT_VALID); | ||
| } | ||
| 
     | 
||
| // 메일 제목 및 템플릿 설정 | ||
| String subject; | ||
| String emailContent; | ||
| String buttonUrl = "#"; | ||
| String buttonUrl = "https://dmu-dasom.netlify.app/recruit/result"; | ||
| String buttonText; | ||
| 
     | 
||
| switch (mailType) { | ||
| case DOCUMENT_RESULT -> { | ||
| subject = "동양미래대학교 컴퓨터소프트웨어공학과 전공 동아리 DASOM 서류 결과 안내"; | ||
| emailContent = "먼저 다솜 34기에 많은 관심을 갖고 지원해 주셔서 감사드리며,<br>" + | ||
| "내부 서류 평가 결과 및 추후 일정에 관해 안내드리고자 이메일을 발송하게 되었습니다.<br>" + | ||
| "모집 폼 합/불합 결과는 아래 버튼 혹은 홈페이지를 통해 확인이 가능합니다."; | ||
| emailContent = "먼저 다솜 34기에 많은 관심을 두고 지원해 주셔서 감사드리며,<br>" + | ||
| "내부 서류 평가 결과 및 추후 일정에 관해 안내해드리고자 이메일을 발송하게 되었습니다.<br>" + | ||
| "서류 전형 결과는 아래 버튼 혹은 홈페이지를 통해 확인이 가능합니다."; | ||
| buttonText = "서류 결과 확인하기"; | ||
| } | ||
| case FINAL_RESULT -> { | ||
| subject = "동양미래대학교 컴퓨터소프트웨어공학과 전공 동아리 DASOM 최종 합격 안내"; | ||
| emailContent = "먼저 다솜 34기에 많은 관심을 갖고 지원해 주셔서 감사드리며,<br>" + | ||
| "최종 면접 결과 및 추후 일정에 관해 안내드리고자 이메일을 발송하게 되었습니다.<br>" + | ||
| "모집 폼 합/불합 결과는 아래 버튼 혹은 홈페이지를 통해 확인이 가능합니다."; | ||
| subject = "동양미래대학교 컴퓨터소프트웨어공학과 전공 동아리 DASOM 최종 면접 결과 안내"; | ||
| emailContent = "먼저 다솜 34기에 많은 관심을 두고 지원해 주셔서 감사드리며,<br>" + | ||
| "최종 면접 결과 및 추후 일정에 관해 안내해드리고자 이메일을 발송하게 되었습니다.<br>" + | ||
| "최종 면접 결과는 아래 버튼 혹은 홈페이지를 통해 확인이 가능합니다."; | ||
| buttonText = "최종 결과 확인하기"; | ||
| } | ||
| default -> throw new IllegalStateException("Unexpected value: " + mailType); | ||
| 
        
          
        
         | 
    @@ -66,7 +69,10 @@ public void sendEmail(String to, String name, MailType mailType) throws Messagin | |
| helper.setTo(to); | ||
| helper.setSubject(subject); | ||
| helper.setText(htmlBody, true); | ||
| helper.setFrom(from); | ||
| helper.setFrom((from != null && !from.isEmpty()) ? from : "[email protected]"); | ||
| 
     | 
||
| // Content-Type을 명시적으로 설정 | ||
| message.setContent(htmlBody, "text/html; charset=utf-8"); | ||
| 
     | 
||
| javaMailSender.send(message); | ||
| } | ||
| 
          
            
          
           | 
    ||
  
    
      This file contains hidden or 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 hidden or 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 | 
|---|---|---|
| 
          
            
          
           | 
    @@ -3,139 +3,119 @@ | |
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <meta name="color-scheme" content="light dark"> | ||
| <meta name="supported-color-schemes" content="light dark"> | ||
| <title>이메일 안내</title> | ||
| <link rel="stylesheet" as="style" crossorigin href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/static/pretendard.css" /> | ||
| <style> | ||
| body { | ||
| </head> | ||
| <body style=" | ||
| background-color: #17171B; | ||
| color: white; | ||
| color: white !important; | ||
| font-family: 'Pretendard', sans-serif; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| height: 100vh; | ||
| margin: 0; | ||
| } | ||
| 
     | 
||
| .email-container { | ||
| margin: 0;"> | ||
| <div style=" | ||
| width: 740px; | ||
| height: 680px; | ||
| background: #17171B; | ||
| padding: 30px; | ||
| position: relative; | ||
| } | ||
| 
     | 
||
| .logo { | ||
| position: relative;"> | ||
| <div style=" | ||
| display: flex; | ||
| justify-content: center; | ||
| position: relative; | ||
| margin-bottom: 20px; | ||
| } | ||
| 
     | 
||
| .logo img { | ||
| width: 21px; | ||
| height: 24px; | ||
| border-radius: 3px; | ||
| } | ||
| 
     | 
||
| .divider { | ||
| margin-bottom: 20px;"> | ||
| <div style=" | ||
| width: 100%; | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| } | ||
| 
     | 
||
| .divider .line { | ||
| align-items: center;"> | ||
| <div style=" | ||
| flex: 1; | ||
| border-top: 1px solid #00B493; | ||
| margin: 0 10px;"> | ||
| 
     | 
||
| </div> | ||
| <img src="https://dmu-dasom.or.kr/static/media/dasomLogo.c82d220d8093c3cb8d7fc0b148cafcd1.svg" alt="로고" style=" | ||
| width: 21px; | ||
| height: 24px; | ||
| border-radius: 3px;"> | ||
| <div style=" | ||
| flex: 1; | ||
| border-top: 1px solid #00B493; | ||
| margin: 0 10px; | ||
| } | ||
| margin: 0 10px;"> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| 
     | 
||
| .title { | ||
| <div style=" | ||
| font-size: 48px; | ||
| font-weight: 900; | ||
| color: #00B493; | ||
| margin-bottom: 30px; | ||
| } | ||
| 
     | 
||
| .greeting { | ||
| margin-bottom: 30px;"> | ||
| DASOM | ||
| </div> | ||
| <div style=" | ||
| font-size: 20px; | ||
| font-weight: 600; | ||
| margin-bottom: 40px; | ||
| } | ||
| margin-bottom: 5px; | ||
| color: white !important;" | ||
| th:text="${name} + '님 안녕하세요.'"> | ||
| </div> | ||
| <div style=" | ||
| font-size: 20px; | ||
| font-weight: 600; | ||
| margin-bottom: 5px; | ||
| color: white !important;"> | ||
| 컴퓨터공학부 전공동아리 다솜입니다. | ||
| </div> | ||
| 
     | 
||
| .content { | ||
| <div style=" | ||
| font-size: 16px; | ||
| font-weight: 400; | ||
| line-height: 2.5; | ||
| text-align: right; | ||
| margin-bottom: 40px; | ||
| } | ||
| 
     | 
||
| .contact { | ||
| font-size: 16px; | ||
| font-weight: 400; | ||
| line-height: 1.5; | ||
| } | ||
| color: white !important;" | ||
| th:utext="${emailContent}"> | ||
| </div> | ||
| 
     | 
||
| .button-container { | ||
| display: flex; | ||
| <div style="display: flex; | ||
| justify-content: flex-end; | ||
| margin-bottom: 40px; | ||
| } | ||
| 
     | 
||
| .button { | ||
| margin-bottom: 40px;"> | ||
| <a th:href="${buttonUrl}" | ||
| style=" | ||
| background: #00B493; | ||
| color: white; | ||
| color: white !important; | ||
| font-size: 16px; | ||
| font-weight: 400; | ||
| padding: 10px 20px; | ||
| border-radius: 5px; | ||
| display: flex; | ||
| align-items: center; | ||
| text-decoration: none; | ||
| } | ||
| 
     | 
||
| .button:hover { | ||
| background: #00987A; | ||
| } | ||
| 
     | 
||
| .button .arrow { | ||
| text-decoration: none;"> | ||
| <span th:text="${buttonText}"> | ||
| </span> | ||
| <span style=" | ||
| border: solid white; | ||
| border-width: 0 2px 2px 0; | ||
| display: inline-block; | ||
| padding: 5px; | ||
| transform: rotate(-45deg); | ||
| margin-left: 10px; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class="email-container"> | ||
| <div class="logo"> | ||
| <div class="divider"> | ||
| <div class="line"></div> | ||
| <img src="logo.png" alt="로고"> | ||
| <div class="line"></div> | ||
| </div> | ||
| </div> | ||
| 
     | 
||
| <div class="title">DASOM</div> | ||
| <div class="greeting" th:text="${name} + '님 안녕하세요.'"></div> | ||
| <div>컴퓨터공학부 전공동아리 다솜입니다.</div> | ||
| 
     | 
||
| <div class="content" th:utext="${emailContent}"></div> | ||
| 
     | 
||
| <div class="button-container"> | ||
| <a th:href="${buttonUrl}" class="button"> | ||
| <span th:text="${buttonText}"></span> <span class="arrow"></span> | ||
| margin-left: 10px;"> | ||
| </span> | ||
| </a> | ||
| </div> | ||
| 
     | 
||
| <div class="contact"> | ||
| <div style="font-size: 16px; | ||
| font-weight: 400; | ||
| line-height: 1.5; | ||
| color: white !important;"> | ||
| 또한, 문의 사항은 본 메일에 회신 또는 아래 번호로 편하게 연락 부탁드립니다.<br> | ||
| 010-6361-3481 | ||
| </div> | ||
| </div> | ||
| </body> | ||
| </html> | ||
| </html> | ||
              File renamed without changes
          
    
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
URL 변경해주세요
->
https://dmu-dasom.or.kr/recruit/result