作者ogamenewbie (._.)
看板java
标题Re: [问题] Javamail 使用proxy(需帐号密码)
时间Tue Mar 9 13:54:51 2010
※ 引述《dada0103 (排球第一)》之铭言:
: 请问各位前辈们:
: 搜寻一下 javamail 设定 proxy 大多都只有指定
: proxyhost
: proxyport
: 如果我的proxy环境还需要使用帐号密码登入 proxy
: 应该使用什麽做设定呢?
: Properties props = System.getProperties()
: props.setProperty("proxySet","true");
: props.setProperty("ProxyHost","IP");
: props.setProperty("ProxyPort","PORT");
: 是用 setProperty 还是用 put呢?
: 恳请前辈们指点~
http://java.sun.com/products/javamail/FAQ.html
Q: How do I configure JavaMail to work through my proxy server?
A: JavaMail
does not currently support accessing mail servers
through a web proxy server. One of the major reasons for using a
... (略)
If your proxy server supports the
SOCKS V4 or V5 protocol
(
http://www.socks.nec.com/aboutsocks.html, RFC1928)
and allows
anonymous connections, you can tell the Java runtime to direct
all TCP socket connections to the SOCKS server. See the
Networking
Properties guide for the latest documentation of the
socksProxyHost
and socksProxyPort properties. These are system-level properties,
not JavaMail session properties. They can be set from the command
line when the application is invoked, for example:
java -DsocksProxyHost=myproxy .... This facility can be used to
... (略)
Without such a SOCKS server, if you want to use JavaMail to
directly access mail servers outside the firewall, the firewall
will need to be configured to allow such access.
JavaMail does not
support access through a HTTP proxy web server.
--
官方文件如是说
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.160.34.52
1F:→ ogamenewbie:话说左上角的 Oracle 害我一直以为我跑错网站... 03/09 14:05
2F:推 dada0103:感谢说明!我也以为跑错站,才想起合并案... 03/10 06:55