fix : 메일발송 설정
This commit is contained in:
@@ -9,6 +9,7 @@ import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import jakarta.mail.*;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
@@ -27,11 +28,6 @@ import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
import jakarta.activation.CommandMap;
|
||||
import jakarta.activation.MailcapCommandMap;
|
||||
import jakarta.mail.Message;
|
||||
import jakarta.mail.MessagingException;
|
||||
import jakarta.mail.Multipart;
|
||||
import jakarta.mail.Session;
|
||||
import jakarta.mail.Transport;
|
||||
import jakarta.mail.internet.InternetAddress;
|
||||
import jakarta.mail.internet.MimeBodyPart;
|
||||
import jakarta.mail.internet.MimeMessage;
|
||||
@@ -69,6 +65,17 @@ public class BOEmailService {
|
||||
private String host;
|
||||
@Value("${mail.port}")
|
||||
private String port;
|
||||
@Value("${mail.username}")
|
||||
private String username;
|
||||
@Value("${mail.password}")
|
||||
private String password;
|
||||
@Value("${mail.connectiontimeout}")
|
||||
private String connectiontimeout;
|
||||
@Value("${mail.timeout}")
|
||||
private String timeout;
|
||||
@Value("${mail.writetimeout}")
|
||||
private String writetimeout;
|
||||
|
||||
|
||||
/* ####################################
|
||||
이메일 발송 서비스 시작
|
||||
@@ -202,12 +209,7 @@ public class BOEmailService {
|
||||
SopmalNm = mapper.selectBOEmailSopmalNm(ListOne);
|
||||
}
|
||||
|
||||
Properties props = System.getProperties();
|
||||
props.put("mail.smtp.host", host);
|
||||
props.put("mail.smtp.port", port);
|
||||
log.info("이메일 발송 SMTP 메소드 진입 확인 => {}", host+":"+port);
|
||||
|
||||
Session session = Session.getInstance(props, null);
|
||||
Session session = this.getMailSession();
|
||||
|
||||
int i = 0;
|
||||
for(BOEmailVO vo : voList) {
|
||||
@@ -337,12 +339,7 @@ public class BOEmailService {
|
||||
SopmalNm = mapper.selectBOEmailSopmalNm(ListOne);
|
||||
}
|
||||
|
||||
Properties props = System.getProperties();
|
||||
props.put("mail.smtp.host", host);
|
||||
props.put("mail.smtp.port", port);
|
||||
log.info("이메일 발송 SMTP 메소드 진입 확인 => {}", host+":"+port);
|
||||
|
||||
Session session = Session.getInstance(props, null);
|
||||
Session session = this.getMailSession();
|
||||
|
||||
int i = 0;
|
||||
for(BOEmailVO vo : voList) {
|
||||
@@ -464,10 +461,8 @@ public class BOEmailService {
|
||||
/**
|
||||
* 메시지 내 치환코드에 따라 변경 처리
|
||||
* @param cn
|
||||
* @param param
|
||||
* @param replaceMap
|
||||
* @param caseNm
|
||||
* @return
|
||||
* @return String
|
||||
*/
|
||||
public String mssageConvert(String cn, DataMap replaceMap) {
|
||||
//필요에 따라 db 갈수 도 있으나 현재는 없다고 판단함
|
||||
@@ -503,4 +498,37 @@ public class BOEmailService {
|
||||
return output;
|
||||
|
||||
}
|
||||
|
||||
private Session getMailSession(){
|
||||
Properties props = System.getProperties();
|
||||
props.put("mail.smtp.host", host);
|
||||
props.put("mail.smtp.port", port);
|
||||
props.put("mail.smtp.auth", "true");
|
||||
props.put("mail.smtp.starttls.enable", "true");
|
||||
props.put("mail.smtp.starttls.required", "true");
|
||||
|
||||
props.put("mail.smtp.connectiontimeout", connectiontimeout);
|
||||
props.put("mail.smtp.timeout", timeout);
|
||||
props.put("mail.smtp.writetimeout", writetimeout);
|
||||
|
||||
props.put("mail.debug", "true");
|
||||
|
||||
log.info("이메일 발송 SMTP 메소드 진입 확인 => {}", host+":"+port);
|
||||
Session session = null;
|
||||
|
||||
try {
|
||||
Authenticator auth = new Authenticator() {
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(username, password);
|
||||
}
|
||||
};
|
||||
|
||||
session = Session.getInstance(props, auth);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
return session;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -477,7 +477,7 @@ public class BbsmngrController {
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value="/selectBbsIdDplctCnfirm", method = RequestMethod.GET)
|
||||
@RequestMapping(value="/selectBbsIdDplctCnfirm", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<WnbtResponse> selectBbsIdDplctCnfirm(BOBbsVO vo, @CookieValue(value = "authSopmalCd") String authSopmalCd){
|
||||
|
||||
List<Map<String, String>> errorList = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user