65. Email session (#7)
This commit is contained in:
@ -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