diff --git a/support-portal-backend/pom.xml b/support-portal-backend/pom.xml index addf18c..13fdd9d 100644 --- a/support-portal-backend/pom.xml +++ b/support-portal-backend/pom.xml @@ -66,6 +66,11 @@ 30.1.1-jre + + com.sun.mail + jakarta.mail + + org.springframework.boot spring-boot-starter-test diff --git a/support-portal-backend/src/main/java/net/shyshkin/study/fullstack/supportportal/backend/service/EmailService.java b/support-portal-backend/src/main/java/net/shyshkin/study/fullstack/supportportal/backend/service/EmailService.java new file mode 100644 index 0000000..26a2cbf --- /dev/null +++ b/support-portal-backend/src/main/java/net/shyshkin/study/fullstack/supportportal/backend/service/EmailService.java @@ -0,0 +1,25 @@ +package net.shyshkin.study.fullstack.supportportal.backend.service; + +import org.springframework.stereotype.Service; + +import javax.mail.Session; +import java.util.Properties; + +import static net.shyshkin.study.fullstack.supportportal.backend.constant.EmailConstant.*; + +@Service +public class EmailService { + + private Session getEmailSession() { + + Properties properties = System.getProperties(); + + properties.put(SMTP_HOST, GMAIL_SMTP_SERVER); + properties.put(SMTP_AUTH, true); + properties.put(SMTP_PORT, DEFAULT_PORT); + properties.put(SMTP_STARTTLS_ENABLE, true); + properties.put(SMTP_STARTTLS_REQUIRED, true); + + return Session.getInstance(properties); + } +}