• 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
테스트서버에서 로그인 인증번호 발송 시 테스트슬랙알림채널로 발송
2025-01-16
.codetogether.ignore
mjon_git
2023-06-12
.gitignore
gitignore 적용
2023-06-12
pom.xml
문자전송개선 테스트
2024-11-27
File name
Commit message
Commit date
java
테스트서버에서 로그인 인증번호 발송 시 테스트슬랙알림채널로 발송
2025-01-16
resources
Merge branch '4875_발송_페이지_로딩_속도개선'
2025-01-13
webapp
ec로 코드 수정 http://pms.iten.co.kr:9999/issues/4573
2025-01-16
File name
Commit message
Commit date
egovframework
custom idgen 수정
2024-11-27
itn
테스트서버에서 로그인 인증번호 발송 시 테스트슬랙알림채널로 발송
2025-01-16
File name
Commit message
Commit date
com
SMS전송 공통코드 기능 추가
2025-01-10
let
테스트서버에서 로그인 인증번호 발송 시 테스트슬랙알림채널로 발송
2025-01-16
web
변경
2024-11-21
File name
Commit message
Commit date
cert
테스트서버에서 로그인 인증번호 발송 시 테스트슬랙알림채널로 발송
2025-01-16
cop
이용약관 > 불법스팸방지정책 페이지 수정
2024-11-26
crypto/web
mjon_git
2023-06-12
fax
문자, 팩스발송 주소록 불러오기 완료
2024-12-24
hangulparser
mjon_git
2023-06-12
kakao
알림톡 슬랙 노출 안되는 부분 수정
2025-01-16
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
테스트서버에서 로그인 인증번호 발송 시 테스트슬랙알림채널로 발송
2025-01-16
module/base
문자전송개선 테스트
2024-11-27
org
mjon_git
2023-06-12
schdlr/service
문자발송로직 > 이벤트 체크
2024-12-23
sec
mjon_git
2023-06-12
solr
mjon_git
2023-06-12
sts
mjon_git
2023-06-12
sym
팩스 속도 개선
2024-12-17
uat
테스트서버에서 로그인 인증번호 발송 시 테스트슬랙알림채널로 발송
2025-01-16
uss
ec로 코드 수정 http://pms.iten.co.kr:9999/issues/4573
2025-01-16
utl
회원 이메일 발송 건수 15분 단위로 기존 200건 -> 500건으로 변경
2024-10-25
File name
Commit message
Commit date
uap
mjon_git
2023-06-12
uia
테스트서버에서 로그인 인증번호 발송 시 테스트슬랙알림채널로 발송
2025-01-16
File name
Commit message
Commit date
service
보안로그인 최근변경 날짜 추가
2024-11-22
web
테스트서버에서 로그인 인증번호 발송 시 테스트슬랙알림채널로 발송
2025-01-16
File name
Commit message
Commit date
ClientIP.java
이준호 문자온 커밋 - IP 받아오는 방식 수정
2023-07-28
EgovLoginController.java
테스트서버에서 로그인 인증번호 발송 시 테스트슬랙알림채널로 발송
2025-01-16
EgovMypageController.java
Merge branch 'master' of http://hylee@vcs.iten.co.kr:9999/hylee/mjon_git
2024-11-22
EgovMypageRESTAPIController.java
utils 정리중
2024-07-05
EmailVO.java
mjon_git
2023-06-12
KmcCertChecker.java
본인인증 LOG 추가
2024-11-22
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 fc75143 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