我发现javamail只支持袜子。有没有我可以用来支持http代理的解决方案?如何让javamail支持http代理
public class MailConnectionTest {
public static void main(String args[]) throws MessagingException {
Properties props = MailConnectionTest.getProperties();
Session session = Session.getDefaultInstance(props, null);
String protocol = "pop3";
String host = "pop.163.com";
String username = "email username";
String password = "1Qaz2wsx3edc&";
Store store = session.getStore(protocol);
store.connect(host, username, password);
System.out.println("Success");
}
private static Properties getProperties() {
Properties props = System.getProperties();
props.put("mail.debug", "false");
// Proxy
props.put("proxySet", "true");
props.put("http.proxyHost", "proxyAdderss");
props.put("http.proxyPort", "8080");
return props;
}
}
您的问题没有意义。 HTTP代理用于HTTP。 JavaMail使用SMTP和POP3和IMAP。不是HTTP。 – EJP
这就是我的观点。你的意思是没有办法使用java代理服务器。那么,javamial可以使用socks代理吗?那么如何使用? – Cain
你为什么要这样? SMTP应该很好,对吧? –