|
|
@@ -1,5 +1,7 @@
|
|
|
package com.lhamacorp.mailserver.service;
|
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.mail.SimpleMailMessage;
|
|
|
import org.springframework.mail.javamail.JavaMailSender;
|
|
|
@@ -12,6 +14,8 @@ public class MailService {
|
|
|
|
|
|
private final JavaMailSender mailSender;
|
|
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(MailService.class);
|
|
|
+
|
|
|
@Value("${spring.mail.username}")
|
|
|
private String from;
|
|
|
|
|
|
@@ -28,6 +32,8 @@ public class MailService {
|
|
|
message.setText(content);
|
|
|
|
|
|
mailSender.send(message);
|
|
|
+
|
|
|
+ log.info("Mail sent to [{}]", to);
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException("Failed to send email: " + e.getMessage(), e);
|
|
|
}
|