属性 "mail.imap.starttls.enable", "true" 不行
Property "mail.imap.starttls.enable", "true" doesn't work
在Oracl sslnotes中说,STARTTLS命令应该通过使用mail.imap.starttls.enable或mail.smtp.starttls.enable到"true"来启用。
"设置时,如果服务器支持STARTTLS命令,就会
在建立连接之后和发送任何登录之前使用
信息”。因此,我按照建议进行了设置:
props.setProperty("mail.imap.starttls.enable", "true");
props.setProperty("mail.store.protocol", "imap");
props.setProperty("mail.imap.auth", "true");
props.setProperty("mail.imap.host", "imap.mail.ru");
Session session = Session.getInstance(props, new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(login + "@" + server, passwd);
}
});
session.setDebug( true);
Store store = session.getStore();
store.connect();
但这是对话:
* OK Welcome
A0 CAPABILITY
* CAPABILITY IMAP4rev1 ID XLIST UIDPLUS UNSELECT MOVE STARTTLS LIST-STATUS LOGINDISABLED
A0 OK CAPABILITY completed
A1 LOGIN tester@mail.ru tester <==== this string is edited
A1 NO [PRIVACYREQUIRED] Command disabled. Please use STARTTLS first.
据我所知,connect 函数没有发送 STARTTLS 命令(尽管该命令应该发送 "after making connection and before sending any login information",正如 Oracle 手册中所承诺的那样)。那么我应该怎么做才能让代码发送这个 STARTTLS?
通过下载最新的 javax.mail.jar 解决。感谢大家。
在Oracl sslnotes中说,STARTTLS命令应该通过使用mail.imap.starttls.enable或mail.smtp.starttls.enable到"true"来启用。 "设置时,如果服务器支持STARTTLS命令,就会 在建立连接之后和发送任何登录之前使用 信息”。因此,我按照建议进行了设置:
props.setProperty("mail.imap.starttls.enable", "true");
props.setProperty("mail.store.protocol", "imap");
props.setProperty("mail.imap.auth", "true");
props.setProperty("mail.imap.host", "imap.mail.ru");
Session session = Session.getInstance(props, new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(login + "@" + server, passwd);
}
});
session.setDebug( true);
Store store = session.getStore();
store.connect();
但这是对话:
* OK Welcome
A0 CAPABILITY
* CAPABILITY IMAP4rev1 ID XLIST UIDPLUS UNSELECT MOVE STARTTLS LIST-STATUS LOGINDISABLED
A0 OK CAPABILITY completed
A1 LOGIN tester@mail.ru tester <==== this string is edited
A1 NO [PRIVACYREQUIRED] Command disabled. Please use STARTTLS first.
据我所知,connect 函数没有发送 STARTTLS 命令(尽管该命令应该发送 "after making connection and before sending any login information",正如 Oracle 手册中所承诺的那样)。那么我应该怎么做才能让代码发送这个 STARTTLS?
通过下载最新的 javax.mail.jar 解决。感谢大家。