A
A
Aliande2016-03-23 14:21:06
Java
Aliande, 2016-03-23 14:21:06

Java mail proxy usage?

I need to send a message (smtp) using a proxy, below is the code, proxies are completely ignored, what to do?

Properties props = new Properties();

            System.setProperty("mail.socket.debug", "true");
            props.put("mail.socket.debug", "true");
            if (_config.getIsProxy()) {
                props.put("mail.smtp.socks.host", proxyHost);
                props.put("mail.smtp.socks.port", proxyPost);

            }
            props.put("mail.smtp.timeout", _config.getTimeout()*1000);
            props.put("mail.smtp.connectiontimeout", _config.getTimeout()*1000);
            props.put("mail.smtp.ssl.enable", "true");
            props.put("mail.store.protocol", "smtp");
            props.put("mail.smtp.host", server);
            props.put("mail.smtp.socketFactory.port", "465");
            props.put("mail.smtp.socketFactory.class",
                    "javax.net.ssl.SSLSocketFactory");
            props.put("mail.smtp.auth", "true");
            props.put("mail.smtp.port", "465");

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2016-03-23
@zolt85

System.setProperty("http.proxyHost", "webcache.example.com");
System.setProperty("http.proxyPort", "8080");

Taken from here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question