65. Email session (#7)
This commit is contained in:
@ -66,6 +66,11 @@
|
|||||||
<version>30.1.1-jre</version>
|
<version>30.1.1-jre</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.mail</groupId>
|
||||||
|
<artifactId>jakarta.mail</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
|||||||
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user