일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- Exception
- jpa
- JDBC
- PostgreSQL
- error
- oracle
- Eclipse
- spring
- MSSQL
- myBatis
- SpringBoot
- Python
- MySQL
- 설정
- ubuntu
- Thymeleaf
- Open Source
- AJAX
- STS
- 문서
- Spring Boot
- JavaScript
- IntelliJ
- git
- Tomcat
- Core Java
- Source
- maven
- 오픈소스
- Docker
- Today
- Total
헤르메스 LIFE
[Exception] javax.mail.AuthenticationFailedException 본문
메일발송 시 아래와 같은 오류가 발생하였다.
javax.mail.AuthenticationFailedException
at javax.mail.Service.connect(Service.java:306)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
Properties props = new Properties();
props.put("mail.smtp.host", host);
props.put("mail.smtp.auth", "true");
Authenticator auth = new MyAuthentication();
Session sess = Session.getInstance(props, auth);
..... 생략
Message msg = new MimeMessage(sess);
Transport.send(msg);
해결책.
MyAuthentication 에는 smtp host의 User ID 와 Password 가 들어 있다.
그것이 틀린 것입니다.
package common.util;
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
public class MyAuthentication extends Authenticator {
PasswordAuthentication pa;
public MyAuthentication() {
pa = new PasswordAuthentication("myid", "password");
}
public PasswordAuthentication getPasswordAuthentication() {
return pa;
}
}
'Exception' 카테고리의 다른 글
The method getServletContext() is undefined for the type HttpServletRequest (0) | 2015.03.24 |
---|---|
Servlet.service() for servlet jsp threw exception java.lang.NullPointerException (0) | 2014.03.10 |
[Oracle] ORA-01652:128(으)로 테이블 공간 TEMP에서 임시 세그먼트를 확장할 수 없습니다. (0) | 2014.02.18 |
[Exception] javax.net.ssl.SSLHandshakeException ..... (0) | 2014.01.03 |
[Exception] log4j.dtd (지정된 파일을 찾을 수 없습니다) (0) | 2013.10.30 |