• Y
  • List All
  • Feedback
    • This Project
    • All Projects
Profile Account settings Log out
  • Favorite
  • Project
  • All
Loading...
  • Log in
  • Sign up
chominsoo4245 / mjon_git star
Forked from hylee / mjon_git
  • Project homeH
  • CodeC
  • IssueI
  • Pull requestP
  • Review R
  • MilestoneM
  • BoardB
  • Files
  • Commit
  • Branches
mjon_gitsrcmainjavaitnletuatuiawebSendMail.java
Download as .zip file
File name
Commit message
Commit date
DATABASE
mjon_git
2023-06-12
src/main
2024-03-20 16:34 마이페이지 최근 발송내역-문자 쿼리 성능개선
2024-03-20
.codetogether.ignore
mjon_git
2023-06-12
.gitignore
gitignore 적용
2023-06-12
pom.xml
플러그인 추가 원복
2024-02-16
File name
Commit message
Commit date
java
2024-03-20 16:34 마이페이지 최근 발송내역-문자 쿼리 성능개선
2024-03-20
resources
2024-03-20 16:34 마이페이지 최근 발송내역-문자 쿼리 성능개선
2024-03-20
webapp
팩스 back단에서 금액체크
2024-03-15
File name
Commit message
Commit date
egovframework
mjon_git
2023-06-12
itn
2024-03-20 16:34 마이페이지 최근 발송내역-문자 쿼리 성능개선
2024-03-20
File name
Commit message
Commit date
com
관리자 문자전송 리스트 기본 검색 기간 변경 - 기본 검색 시작일자 한달전에서 하루전으로 변경
2024-01-26
let
2024-03-20 16:34 마이페이지 최근 발송내역-문자 쿼리 성능개선
2024-03-20
web
메인메뉴 및 사이트맵에서 선거 후보자 정보가 없는 경우 선거문자 메뉴가 안보이도록 처리
2024-02-08
File name
Commit message
Commit date
cop
사용자 이용정지인 경우 알림톡 전송, 팩스 전송, 1:1 문의등록 화면 접속 불가처리
2023-11-09
crypto/web
mjon_git
2023-06-12
fax
팩스 back단에서 금액체크
2024-03-15
hangulparser
mjon_git
2023-06-12
kakao
발송결과, 예약문자관리 메뉴 검색일자 지정 - 검색일자가 없는 경우 전날 ~ 금일 기간으로 검색되도록 지정
2024-02-07
komoran
mjon_git
2023-06-12
lett
선택한 그림문자의 우선선위 변경 기능 추가
2023-09-05
mail
휴면회원으로 지정 기준날짜 변경
2023-07-25
main
이준호 문자온 커밋 - IP 받아오는 방식 수정
2023-07-28
mjo
id 로직 주식처리
2024-03-11
module/base
mjon_git
2023-06-12
org
mjon_git
2023-06-12
schdlr/service
2024-03-14 15:21 스케쥴러 트랜잭션 오류 수정
2024-03-14
sec
mjon_git
2023-06-12
solr
mjon_git
2023-06-12
sts
mjon_git
2023-06-12
sym
관리자방문수 관리 쿼리 성능개선, 기간검색 시작일 초기값 설정 추가
2023-09-13
uat
2024-03-20 16:34 마이페이지 최근 발송내역-문자 쿼리 성능개선
2024-03-20
uss
2024-03-20 16:34 마이페이지 최근 발송내역-문자 쿼리 성능개선
2024-03-20
utl
이준호 문자온 커밋 - IP 받아오는 방식 수정
2023-07-28
File name
Commit message
Commit date
uap
mjon_git
2023-06-12
uia
2024-03-20 16:34 마이페이지 최근 발송내역-문자 쿼리 성능개선
2024-03-20
File name
Commit message
Commit date
service
2024-03-20 16:34 마이페이지 최근 발송내역-문자 쿼리 성능개선
2024-03-20
web
2024-03-20 16:34 마이페이지 최근 발송내역-문자 쿼리 성능개선
2024-03-20
File name
Commit message
Commit date
ClientIP.java
이준호 문자온 커밋 - IP 받아오는 방식 수정
2023-07-28
EgovLoginController.java
아이디찾기 일부 결과값 오류 수정
2023-09-21
EgovMypageController.java
2024-03-20 16:34 마이페이지 최근 발송내역-문자 쿼리 성능개선
2024-03-20
EgovMypageRESTAPIController.java
feat: api사용안내 오타 수정
2023-08-09
EmailVO.java
mjon_git
2023-06-12
KmcCertChecker.java
mjon_git
2023-06-12
SMTPAuthenticator.java
mjon_git
2023-06-12
SendLogVO.java
mjon_git
2023-06-12
SendMail.java
mjon_git
2023-06-12
UserCheckController.java
mjon_git
2023-06-12
hylee 2023-06-12 bf289e9 mjon_git UNIX
Raw Open in browser Change history
package itn.let.uat.uia.web; import java.io.File; import java.time.LocalDateTime; import java.util.Date; import java.util.Properties; import javax.activation.DataHandler; import javax.activation.FileDataSource; import javax.mail.Authenticator; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Multipart; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import javax.mail.internet.MimeUtility; import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpStatus; import itn.let.mail.service.StatusResponse; /*import itn.let.uat.uia.web.EmailVO; import itn.let.uat.uia.web.SMTPAuthenticator;*/ public class SendMail { public void sendMail(EmailVO vo) throws Exception { try { Properties props = new Properties(); /* * props.put("mail.transport.protocol", "smtp");// 프로토콜 설정 * props.put("mail.smtp.host", "smtp.gmail.com");// gmail SMTP 서비스 주소(호스트) * props.put("mail.smtp.port", "465");// gmail SMTP 서비스 포트 설정 * props.put("mail.smtp.starttls.enable","true"); // gmail 인증용 Secure Socket * Layer(SSL) 설정 props.setProperty("mail.smtp.socketFactory.class", * "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true");// * SMTP 인증을 설정 props.put("mail.debug", "true"); // log를 위한 debug 옵션 추가 */ props.put("mail.smtp.auth", "true");// SMTP 인증을 설정 props.put("mail.smtp.starttls.enable", "true"); // props.put("mail.transport.protocol", "smtp");// 프로토콜 설정 props.put("mail.smtp.host", "smtp.gmail.com");// gmail SMTP 서비스 주소(호스트) props.put("mail.smtp.port", "587");// gmail SMTP 서비스 포트 설정 props.put("mail.smtp.ssl.trust", "smtp.gmail.com"); props.put("mail.smtp.ssl.protocols", "TLSv1.2"); // props.put("mail.smtp.debug", "true"); // gmail 인증용 Secure Socket Layer(SSL) 설정 props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); // 인증정보 Authenticator auth = new SMTPAuthenticator(); Session mailSession = Session.getDefaultInstance(props, auth); // MimeMessage mailMessage = mailImpl.createMimeMessage(); MimeMessage message = new MimeMessage(mailSession); InternetAddress from = new InternetAddress(vo.getSend_from()); message.setFrom(from); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(vo.getSend_to())); message.setSubject(vo.getTitle()); message.setContent(vo.getContents(), "text/html;charset=UTF-8"); // message.setText(vo.getContents()); message.setSentDate(new Date()); Transport.send(message); } catch (MessagingException e) { e.printStackTrace(); } } public void sendMail2(EmailVO vo) throws Exception { try { Properties props = new Properties(); /* * props.put("mail.transport.protocol", "smtp");// 프로토콜 설정 * props.put("mail.smtp.host", "smtp.gmail.com");// gmail SMTP 서비스 주소(호스트) * props.put("mail.smtp.port", "465");// gmail SMTP 서비스 포트 설정 * props.put("mail.smtp.starttls.enable","true"); // gmail 인증용 Secure Socket * Layer(SSL) 설정 props.setProperty("mail.smtp.socketFactory.class", * "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true");// * SMTP 인증을 설정 props.put("mail.debug", "true"); // log를 위한 debug 옵션 추가 */ // props.put("mail.smtp.auth", "true");// SMTP 인증을 설정 // props.put("mail.smtp.starttls.enable","true"); // //props.put("mail.transport.protocol", "smtp");// 프로토콜 설정 // props.put("mail.smtp.host", "smtp.worksmobile.com");// gmail SMTP 서비스 주소(호스트) // props.put("mail.smtp.port", "587");// gmail SMTP 서비스 포트 설정 // /*props.put("mail.smtp.ssl.trust","smtp.gmail.com"); // props.put("mail.smtp.ssl.protocols", "TLSv1.2");*/ // props.put("mail.smtp.starttls.enable","true"); // props.put("mail.smtp.debug", "true"); // gmail 인증용 Secure Socket Layer(SSL) 설정 // props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory"); // worksmobile 계정 설정 props.put("mail.smtp.host", "smtp.worksmobile.com"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); props.put("mail.smtp.ssl.enable", "true"); props.put("mail.smtp.ssl.trust", "smtp.worksmobile.com"); props.put("mail.smtp.ssl.protocols", "TLSv1.2"); // props.put("mail.smtp.debug", "true"); // 인증정보 Authenticator auth = new SMTPAuthenticator(); Session mailSession = Session.getDefaultInstance(props, auth); /* * Session mailSession = Session.getInstance(props, new * javax.mail.Authenticator() { protected PasswordAuthentication * getPasswordAuthentication() { return new * PasswordAuthentication("noreply@munjaon.co.kr", "easytour7!"); } }); */ // mailSession.setDebug(true); // MimeMessage mailMessage = mailImpl.createMimeMessage(); MimeMessage message = new MimeMessage(mailSession); InternetAddress from = new InternetAddress(vo.getSend_from()); message.setFrom(from); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(vo.getSend_to())); message.setSubject(vo.getTitle()); message.setContent(vo.getContents(), "text/html;charset=UTF-8"); // message.setText(vo.getContents()); message.setSentDate(new Date()); Transport.send(message); } catch (MessagingException e) { e.printStackTrace(); } } // public SuccessResponse itnSendMail(EmailVO vo) throws Exception { public void itnSendMail(EmailVO vo) throws Exception { Properties props = new Properties(); String returnMsg = "지원해 주셔서 감사합니다."; HttpStatus status = HttpStatus.OK; // worksmobile 계정 설정 props.put("mail.smtp.host", "smtp.worksmobile.com"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); props.put("mail.smtp.ssl.enable", "true"); props.put("mail.smtp.ssl.trust", "smtp.worksmobile.com"); props.put("mail.smtp.ssl.protocols", "TLSv1.2"); // props.put("mail.smtp.debug", "true"); // 인증정보 Authenticator auth = new SMTPAuthenticator(); Session mailSession = Session.getDefaultInstance(props, auth); Multipart mp = new MimeMultipart(); // 파일 영역 if(StringUtils.isNotEmpty(vo.getAtch_file_name())) { System.out.println(" IN vo.getAtch_file_name() :: "+vo.getAtch_file_name()); MimeBodyPart mailFile = new MimeBodyPart(); FileDataSource fds = new FileDataSource(new File(vo.getAtch_file_path()).getAbsolutePath()); mailFile.setDataHandler(new DataHandler(fds)); mailFile.setFileName(MimeUtility.encodeText(vo.getAtch_file_name(), "euc-kr","B")); mp.addBodyPart(mailFile); } //메일 영역 MimeBodyPart mailInfo = new MimeBodyPart(); mailInfo.setContent(vo.getContents(), "text/html; charset=UTF-8"); mp.addBodyPart(mailInfo); // mailSession.setDebug(true); MimeMessage message = new MimeMessage(mailSession); message.setFrom(new InternetAddress(vo.getSend_from())); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(vo.getSend_to())); message.setSubject(vo.getTitle()); message.setContent(vo.getContents(), "text/html;charset=UTF-8"); message.setSentDate(new Date()); message.setContent(mp); Transport.send(message); // return new SuccessResponse(status, returnMsg, LocalDateTime.now()); } }

          
        
    
    
Copyright Yona authors & © NAVER Corp. & NAVER LABS Supported by NAVER CLOUD PLATFORM

or
Sign in with github login with Google Sign in with Google
Reset password | Sign up