最新バージョンのJavaMailに更新されたサイトを見つけようとしていますが、試行するたびにこの厄介なエラー(デバッグが有効)
ヘルプが表示されますか?
DEBUG: setDebug: JavaMail version 1.4.5
DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]
DEBUG POP3: mail.pop3.rsetbeforequit: false
DEBUG POP3: mail.pop3.disabletop: false
DEBUG POP3: mail.pop3.forgettopheaders: false
DEBUG POP3: mail.pop3.cachewriteto: false
DEBUG POP3: mail.pop3.filecache.enable: false
DEBUG POP3: mail.pop3.keepmessagecontent: false
DEBUG POP3: mail.pop3.starttls.enable: false
DEBUG POP3: mail.pop3.starttls.required: false
DEBUG POP3: mail.pop3.apop.enable: false
DEBUG POP3: mail.pop3.disablecapa: false
DEBUG POP3: connecting to host "pop.mail.yahoo.com", port 110, isSSL false
S: +OK hello from popgate-0.8.0.357900 pop001.mail.ir2.yahoo.com
C: CAPA
S: +OK CAPA list follows
IMPLEMENTATION popgate-0.8.0.357900
XOIP
EXPIRE-NEVER
PIPELINING
RESP-CODES
TOP
UIDL
USER
SASL LOGIN PLAIN
STLS
.
DEBUG POP3: PIPELINING enabled
DEBUG POP3: authentication command trace suppressed
DEBUG POP3: authentication command failed
C: QUIT
S: +OK
javax.mail.AuthenticationFailedException: [AUTH] Access to this service is not permitted.
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:208)
at javax.mail.Service.connect(Service.java:295)
at javax.mail.Service.connect(Service.java:176)
at dong.pong.ping.Client.main(Client.java:42)
コード:
String smtpHost = "smtp.mail.yahoo.com";
String popHost = "pop.mail.yahoo.com";
String from = "classified@yahoo.com";
String to = "classified@yahoo.com";
String username = "classified";
String password = "secret";
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", smtpHost);
props.put("mail.smtp.port", 587);
// Get session
Session session = Session.getDefaultInstance(props, null);
session.setDebug(true);
Store store = session.getStore("pop3");
store.connect(popHost, username, password);
// Define message
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO,
new InternetAddress(to));
message.setSubject("Hello JavaMail");
message.setText("Welcome to Yahoo's JavaMail");
// Send message
Transport.send(message);
動作するコードをお持ちの方がいらっしゃいましたら、投稿していただけますか?ありがとう