-
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.
* chore: timezone seoul 설정 * chore: 깃 템플릿 추가, readme.md 추가 * chore: 예외처리, 전역 환경 설정 외 * feat: 데이터 모델링 * chore: 🐳 cicd 설정 * chore: 🐳 workflow lowercase 로 수정 * chore: 디스코드 webhook 테스트 * chore: :global: cors 설정 * chore: 🐳 cors 변경사항 yml 재적용 * feat: ✨ 팀(방) 생성 기능 구현 (#9) * feat: 목표 점검(캘린더) 기능 구현 (#11) * feat: ✨ 초대코드 이메일 전송 기능 구현 (#13)
- Loading branch information
1 parent
5ebf4ec
commit 7eb9c74
Showing
6 changed files
with
83 additions
and
0 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
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
39 changes: 39 additions & 0 deletions
39
src/main/java/com/goormdari/global/config/email/EmailClient.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,39 @@ | ||
package com.goormdari.global.config.email; | ||
|
||
import jakarta.mail.MessagingException; | ||
import jakarta.mail.internet.MimeMessage; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.mail.javamail.JavaMailSender; | ||
import org.springframework.mail.javamail.JavaMailSenderImpl; | ||
import org.springframework.mail.javamail.MimeMessageHelper; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Slf4j | ||
@Component | ||
@RequiredArgsConstructor | ||
public class EmailClient { | ||
|
||
private final JavaMailSender javaMailSender; | ||
private final JavaMailSenderImpl mailSender; | ||
|
||
public void sendOneEmail(String from, String to, String joinCode) { | ||
try { | ||
MimeMessage mimeMessage = mailSender.createMimeMessage(); | ||
|
||
// 수신자, 제목, 본문 설정 | ||
String subject = "[구름다리] 팀 초대 코드 안내"; | ||
String body = from + "님의 초대입니다.\n" + "https://9oormdari.vercel.app/" + " 구름다리 서비스 초대 코드: " + joinCode; | ||
MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage); | ||
mimeMessageHelper.setTo(to); | ||
mimeMessageHelper.setSubject(subject); | ||
mimeMessageHelper.setText(body, true); | ||
|
||
// 이메일 전송 | ||
mailSender.send(mimeMessage); | ||
|
||
} catch (MessagingException e) { | ||
log.error(e.getMessage(), e); | ||
} | ||
} | ||
} |