Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion back/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation ("org.springframework.boot:spring-boot-starter-data-redis")
implementation("org.springframework.boot:spring-boot-starter-mail")

// QueryDSL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import com.back.global.exception.ServiceException;
import jakarta.mail.MessagingException;
import jakarta.mail.internet.MimeMessage;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
Expand All @@ -14,15 +13,24 @@

@Slf4j
@Service
@RequiredArgsConstructor
@ConditionalOnBean(JavaMailSender.class)
public class EmailService {
private final JavaMailSender mailSender;

public EmailService(@Autowired(required = false) JavaMailSender mailSender) {
this.mailSender = mailSender;
if (mailSender == null) {
log.warn("JavaMailSender is not available. Email sending will be disabled.");
}
}

/**
* 간단한 텍스트 이메일 발송
*/
public void sendSimpleEmail(String to, String subject, String text) {
if (mailSender == null) {
log.warn("JavaMailSender is not available. Skipping email to: {}", to);
return;
}
try {
MimeMessage message = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message, true, "UTF-8");
Expand All @@ -44,6 +52,10 @@ public void sendSimpleEmail(String to, String subject, String text) {
* HTML 이메일 발송
*/
public void sendHtmlEmail(String to, String subject, String htmlContent) {
if (mailSender == null) {
log.warn("JavaMailSender is not available. Skipping email to: {}", to);
return;
}
try {
MimeMessage message = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message, true, "UTF-8");
Expand Down

This file was deleted.

3 changes: 0 additions & 3 deletions back/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@ spring:
username: sa
password:
driver-class-name: org.h2.Driver
autoconfigure:
exclude:
- org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration
3 changes: 0 additions & 3 deletions back/src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
spring:
autoconfigure:
exclude:
- org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration
datasource:
url: jdbc:mysql://devcos-team10-mysql.czvbgr7hie3i.ap-northeast-2.rds.amazonaws.com:3306/fivelogic?useSSL=true&serverTimezone=Asia/Seoul&characterEncoding=UTF-8
username: ${DB_USERNAME}
Expand Down
3 changes: 0 additions & 3 deletions back/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ spring:
import: optional:file:.env[.properties]
profiles:
active: dev
autoconfigure:
exclude:
- org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration
output:
ansi:
enabled: always
Expand Down