• 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
Merge branch 'master_tolag3'
2025-07-21
.codetogether.ignore
mjon_git
2023-06-12
.gitignore
개정약관 2024로 수정
2025-07-16
pom.xml
웹서버 교체, 세션서버 추가, 본인인증 수정 - http1.1 -> http2.0 웹서버 교체 - valkey 추가 - 본인인증 모듈화
2025-07-21
File name
Commit message
Commit date
java
웹서버 교체, 세션서버 추가, 본인인증 수정 - http1.1 -> http2.0 웹서버 교체 - valkey 추가 - 본인인증 모듈화
2025-07-21
resources
Merge branch 'master_tolag3'
2025-07-21
webapp
Merge branch 'master_tolag3'
2025-07-21
File name
Commit message
Commit date
egovframework
custom idgen 수정
2024-11-27
itn
웹서버 교체, 세션서버 추가, 본인인증 수정 - http1.1 -> http2.0 웹서버 교체 - valkey 추가 - 본인인증 모듈화
2025-07-21
File name
Commit message
Commit date
com
웹서버 교체, 세션서버 추가, 본인인증 수정 - http1.1 -> http2.0 웹서버 교체 - valkey 추가 - 본인인증 모듈화
2025-07-21
let
웹서버 교체, 세션서버 추가, 본인인증 수정 - http1.1 -> http2.0 웹서버 교체 - valkey 추가 - 본인인증 모듈화
2025-07-21
web
메인 팝업 캐시 사용자 완료
2025-02-28
File name
Commit message
Commit date
cert
웹서버 교체, 세션서버 추가, 본인인증 수정 - http1.1 -> http2.0 웹서버 교체 - valkey 추가 - 본인인증 모듈화
2025-07-21
cmm/vo
문자전송 진행중
2025-01-20
cop
이용약관 > 불법스팸방지정책 페이지 수정
2024-11-26
crypto/web
mjon_git
2023-06-12
fax
웹서버 교체, 세션서버 추가, 본인인증 수정 - http1.1 -> http2.0 웹서버 교체 - valkey 추가 - 본인인증 모듈화
2025-07-21
hangulparser
mjon_git
2023-06-12
kakao
알림톡 faq key값 수정
2025-06-22
komoran
mjon_git
2023-06-12
lett
선택한 그림문자의 우선선위 변경 기능 추가
2023-09-05
mail
문자발송로직 impl 화 완료 -> 리펙토링 진행 중
2024-09-27
main
2024-11-22 10:51 과부하 쿼리 주석처리
2024-11-22
mjo
웹서버 교체, 세션서버 추가, 본인인증 수정 - http1.1 -> http2.0 웹서버 교체 - valkey 추가 - 본인인증 모듈화
2025-07-21
module/base
알림톡 발송로직 테스트 중
2025-03-26
org
mjon_git
2023-06-12
schdlr/service
친구톡 환불 주석
2025-05-13
sec
mjon_git
2023-06-12
solr
mjon_git
2023-06-12
sts
mjon_git
2023-06-12
sym
2025-05-08 15:14 문자온 SEO 개선
2025-05-08
uat
웹서버 교체, 세션서버 추가, 본인인증 수정 - http1.1 -> http2.0 웹서버 교체 - valkey 추가 - 본인인증 모듈화
2025-07-21
uss
발송결과 리스트 화면 완료
2025-01-23
utl
2025-05-08 문자온 사이트 SEO 개선 작업
2025-05-08
File name
Commit message
Commit date
uap
mjon_git
2023-06-12
uia
웹서버 교체, 세션서버 추가, 본인인증 수정 - http1.1 -> http2.0 웹서버 교체 - valkey 추가 - 본인인증 모듈화
2025-07-21
File name
Commit message
Commit date
service
보안로그인 최근변경 날짜 추가
2024-11-22
web
웹서버 교체, 세션서버 추가, 본인인증 수정 - http1.1 -> http2.0 웹서버 교체 - valkey 추가 - 본인인증 모듈화
2025-07-21
File name
Commit message
Commit date
ClientIP.java
이준호 문자온 커밋 - IP 받아오는 방식 수정
2023-07-28
EgovLoginController.java
웹서버 교체, 세션서버 추가, 본인인증 수정 - http1.1 -> http2.0 웹서버 교체 - valkey 추가 - 본인인증 모듈화
2025-07-21
EgovMypageController.java
웹서버 교체, 세션서버 추가, 본인인증 수정 - http1.1 -> http2.0 웹서버 교체 - valkey 추가 - 본인인증 모듈화
2025-07-21
EgovMypageRESTAPIController.java
utils 정리중
2024-07-05
EmailVO.java
mjon_git
2023-06-12
KmcCertChecker.java
웹서버 교체, 세션서버 추가, 본인인증 수정 - http1.1 -> http2.0 웹서버 교체 - valkey 추가 - 본인인증 모듈화
2025-07-21
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 756fe95 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