Programming
No. | 374 | ||||||||
Name. | swindler | ||||||||
Subject. | javax.mail 인증통해서 메일 발송시 | ||||||||
Main Cate. | Java | ||||||||
Sub Cate. | |||||||||
Date. | 2007-06-21 10:44 | ||||||||
Hit. | 6970 (211.181.247.3) | ||||||||
File. | |||||||||
인증없이 Session 을 만들때는 아래와 같고 Session session=Session.getDefaultInstance(properties, null); 인증필요시는 아래처럼 생성한다. Authenticator auth = new SMTPAuthenticator(smtpId, smtpPwd); Session session=Session.getInstance(properties, auth); public final class SMTPAuthenticator extends javax.mail.Authenticator { private String id; private String pw; public SMTPAuthenticator(String id, String pw) { this.id = id; this.pw = pw; } protected javax.mail.PasswordAuthentication getPasswordAuthentication() { return new javax.mail.PasswordAuthentication(id, pw); } } 이렇게 했으나 실제 sendmail 로그를 찾아보니 인증을 하지 않는다. 그건 properties.put("mail.smtp.auth", "true"); 를 추가해서 인증하라고 설정을 해야 된다. [바로가기 링크] : http://coolx.net/cboard/develop/374 |
|||||||||
|
|||||||||
[Modify] [Delete] | [Reply] [List] |