I've setup javamail to run through a socks proxy with ssl, but it won't go through it. I tried setting both mail.smtp.socks.host and mail.smtp.socks.port but it keeps going direct to the mail host. Here's my properties:
smtpProps = new Properties();
smtpProps.setProperty("mail.smtp.host", sendHost);
smtpProps.setProperty("mail.smtp.port", String.valueOf(sendPort));
smtpProps.setProperty("mail.transport.protocol", "smtps");
smtpProps.setProperty("mail.smtp.ssl.enable", "true");
smtpProps.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
smtpProps.setProperty("mail.smtp.socketFactory.fallback", "true");
smtpProps.setProperty("mail.smtp.auth", "true");
smtpProps.setProperty("mail.smtp.connectiontimeout", String.valueOf(sendConnTimeout) );
smtpProps.setProperty("mail.smtp.writetimeout", String.valueOf(sendTimeout) );
smtpProps.setProperty("mail.smtp.socks.host", proxyHost);
smtpProps.setProperty("mail.smtp.socks.port", String.valueOf(proxyPort));
smtpProps.setProperty("mail.debug", "true");
smtpProps.setProperty("mail.socket.debug", "true");
I've tried all smtps property name combination without any success. I'm using Java 7 and javamail 1.4.7. The only one workaround I found for now is to use a custom version of SSL socket factory
smtpProps.setProperty("mail.smtp.socketFactory.class",
proxied?
"my.socks.ProxiedSSLSocketFactory" :
"javax.net.ssl.SSLSocketFactory");
` obviously I can't use system properties socksProxyHost & socksProxyPort. Any ideas?