From bc0bde22f290f00cc6e5c687b9b3b096ac5b612b Mon Sep 17 00:00:00 2001
From: fakerdeft
Date: Tue, 17 Mar 2026 02:22:05 +0900
Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9B=B0=EC=BB=B4=20=EB=A9=94=EC=9D=BC?=
=?UTF-8?q?=20=EC=8B=A4=EC=A0=9C=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=EB=8D=B0?=
=?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EB=A0=8C=EB=8D=94=EB=A7=81=20=EB=B0=8F=20?=
=?UTF-8?q?CD=20Gmail=20=ED=99=98=EA=B2=BD=EB=B3=80=EC=88=98=20=EB=88=84?=
=?UTF-8?q?=EB=9D=BD=20=EC=88=98=EC=A0=95=20=EB=93=B1=20-=20MailAdapter.se?=
=?UTF-8?q?ndWelcomeMail=EC=97=90=20MarathonEventPort=20=EC=A3=BC=EC=9E=85?=
=?UTF-8?q?,=20=EC=88=98=EB=8F=84=EA=B6=8C=20=EA=B8=B0=EC=A4=80=20?=
=?UTF-8?q?=EC=83=81=EC=9C=84=202=EA=B0=9C=20=EC=9D=B4=EB=B2=A4=ED=8A=B8?=
=?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=20-=20=EC=9B=B0=EC=BB=B4=20=ED=85=9C?=
=?UTF-8?q?=ED=94=8C=EB=A6=BF=20=ED=95=98=EB=93=9C=EC=BD=94=EB=94=A9=20?=
=?UTF-8?q?=EC=83=98=ED=94=8C=20=EC=B9=B4=EB=93=9C=20=EC=A0=9C=EA=B1=B0,?=
=?UTF-8?q?=20th:each=EB=A1=9C=20=EC=8B=A4=EC=A0=9C=20=EB=8D=B0=EC=9D=B4?=
=?UTF-8?q?=ED=84=B0=20=EB=A0=8C=EB=8D=94=EB=A7=81=20-=20cd-prod.yml=20.en?=
=?UTF-8?q?v=20=EC=83=9D=EC=84=B1=20=EC=8B=9C=20GMAIL=5FUSERNAME/PASSWORD?=
=?UTF-8?q?=20=EB=88=84=EB=9D=BD=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/cd-prod.yml | 2 +
app/config | 2 +-
.../com/maggom/app/adapter/MailAdapter.kt | 13 ++++-
.../resources/templates/mail/welcome.html | 50 +++++++++----------
4 files changed, 40 insertions(+), 27 deletions(-)
diff --git a/.github/workflows/cd-prod.yml b/.github/workflows/cd-prod.yml
index 96ea1c4..f5b56f2 100644
--- a/.github/workflows/cd-prod.yml
+++ b/.github/workflows/cd-prod.yml
@@ -97,6 +97,8 @@ jobs:
JWT_SECRET=${{ secrets.JWT_SECRET }}
SES_SMTP_USERNAME=${{ secrets.SES_SMTP_USERNAME }}
SES_SMTP_PASSWORD=${{ secrets.SES_SMTP_PASSWORD }}
+ GMAIL_USERNAME=${{ secrets.GMAIL_USERNAME }}
+ GMAIL_PASSWORD=${{ secrets.GMAIL_PASSWORD }}
EOF
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
diff --git a/app/config b/app/config
index b932dce..9636abe 160000
--- a/app/config
+++ b/app/config
@@ -1 +1 @@
-Subproject commit b932dce24aa802d5872b80a147d6c161f961698e
+Subproject commit 9636abe787d7e4d88b2167644400ae95dd1e6b6a
diff --git a/app/src/main/kotlin/com/maggom/app/adapter/MailAdapter.kt b/app/src/main/kotlin/com/maggom/app/adapter/MailAdapter.kt
index 28d36a7..851b51b 100644
--- a/app/src/main/kotlin/com/maggom/app/adapter/MailAdapter.kt
+++ b/app/src/main/kotlin/com/maggom/app/adapter/MailAdapter.kt
@@ -5,6 +5,7 @@ import com.maggom.auth.port.out.EmailSenderPort
import com.maggom.auth.port.out.TestMailPort
import com.maggom.auth.port.out.WelcomeMailPort
import com.maggom.event.domain.MarathonEvent
+import com.maggom.event.port.out.MarathonEventPort
import com.maggom.event.port.out.NotificationMailPort
import jakarta.mail.internet.InternetAddress
import jakarta.mail.internet.MimeMessage
@@ -28,8 +29,14 @@ class MailAdapter(
@Value("\${spring.mail.from-name}") private val fromName: String,
@Value("\${maggom.mail.fallback.from-email:#{null}}") private val fallbackFromEmail: String?,
@Autowired(required = false) @Qualifier("gmailMailSender") private val fallbackMailSender: JavaMailSender?,
+ private val marathonEventPort: MarathonEventPort,
) : EmailSenderPort, WelcomeMailPort, NotificationMailPort, TestMailPort {
+ companion object {
+ private val DEFAULT_REGIONS = listOf("수도권")
+ private const val WELCOME_EVENTS_COUNT = 2
+ }
+
private val log = LoggerFactory.getLogger(javaClass)
override fun sendAuthCode(message: AuthCodeEmailMessage) {
@@ -46,11 +53,15 @@ class MailAdapter(
}
override fun sendWelcomeMail(to: String) {
+ val events = marathonEventPort.findOpenByRegions(DEFAULT_REGIONS).take(WELCOME_EVENTS_COUNT)
+ val context = Context(Locale.KOREAN).apply {
+ setVariable("events", events)
+ }
sendHtml(
to = to,
subject = "[마꼼] 구독을 시작했어요! 🏃",
template = "mail/welcome",
- context = Context(Locale.KOREAN),
+ context = context,
)
}
diff --git a/app/src/main/resources/templates/mail/welcome.html b/app/src/main/resources/templates/mail/welcome.html
index cd6193b..77b1847 100644
--- a/app/src/main/resources/templates/mail/welcome.html
+++ b/app/src/main/resources/templates/mail/welcome.html
@@ -29,31 +29,31 @@
이런 형식으로 알림을 받아보실 수 있어요.
-
-
-
-
- | 2026 서울 봄 마라톤 |
-
- 대회 사이트
- |
-
-
-
대회일: 2026.04.19 | 지역: 서울시 어쩌구 | 코스: 10K, 하프, 풀
-
신청기간: 2026.03.01 ~ 2026.04.01
-
-
-
-
-
- | 2026 한강 하프마라톤 |
-
- 대회 사이트
- |
-
-
-
대회일: 2026.05.10 | 지역: 서울시 어쩌구 | 코스: 하프
-
신청기간: 2026.03.15 ~ 2026.04.20
+
+
+
+
+
+ 대회일: 2026.04.20
+ |
+ 지역: 수도권
+ |
+ 코스: 10K, 하프
+
+
+ 신청기간:
+ 2026.03.01
+ ~
+ 2026.04.01
+
+