From 83322a7b3cc9aa33940b8c6b380bebf3267abdb3 Mon Sep 17 00:00:00 2001 From: sichoi42 <42.4.sichoi@gmail.com> Date: Sat, 2 Sep 2023 14:35:36 +0900 Subject: [PATCH] =?UTF-8?q?[BE]=20FIX:=20=EB=A9=94=EC=9D=BC=20=EB=B0=9C?= =?UTF-8?q?=EC=8B=A0=EC=9E=90=20=EC=9D=B4=EB=A6=84=EC=9D=B4=2042CABI?= =?UTF-8?q?=EB=A1=9C=20=ED=91=9C=EC=8B=9C=EB=90=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/ftclub/cabinet/config/GmailProperties.java | 3 +++ .../main/java/org/ftclub/cabinet/utils/mail/EmailSender.java | 2 +- backend/src/test/resources/application.yml | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/config/GmailProperties.java b/backend/src/main/java/org/ftclub/cabinet/config/GmailProperties.java index 3cdb9b405..51b22f28d 100644 --- a/backend/src/main/java/org/ftclub/cabinet/config/GmailProperties.java +++ b/backend/src/main/java/org/ftclub/cabinet/config/GmailProperties.java @@ -17,6 +17,9 @@ public class GmailProperties { @Value("${spring.mail.port}") private int mailServerPort; + @Value("${spring.mail.display-sender-name}") + private String displaySenderName; + @Value("${spring.mail.username}") private String username; diff --git a/backend/src/main/java/org/ftclub/cabinet/utils/mail/EmailSender.java b/backend/src/main/java/org/ftclub/cabinet/utils/mail/EmailSender.java index 116cb0acd..289656cd2 100644 --- a/backend/src/main/java/org/ftclub/cabinet/utils/mail/EmailSender.java +++ b/backend/src/main/java/org/ftclub/cabinet/utils/mail/EmailSender.java @@ -31,7 +31,7 @@ public void sendMail(String name, String to, String subject, String template) MimeMessage message = javaMailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true, "UTF-8"); - helper.setFrom(gmailProperties.getUsername()); + helper.setFrom(gmailProperties.getDisplaySenderName() + " <" + gmailProperties.getUsername() + ">"); helper.setTo(to); helper.setSubject(subject); diff --git a/backend/src/test/resources/application.yml b/backend/src/test/resources/application.yml index 8deafde45..fa3165899 100644 --- a/backend/src/test/resources/application.yml +++ b/backend/src/test/resources/application.yml @@ -56,6 +56,7 @@ spring: no-risk-of-blackhole: 0 42 1 1 * * # 매월 1일 1시 42분 0초 mail: + display-sender-name: "42CABI" soonoverdue: term: -1 subject: "42CABI 사물함 연체 예정 알림"